llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.48k stars 11.77k forks source link

-save-temps flag does not work #41153

Closed pmatos closed 5 years ago

pmatos commented 5 years ago
Bugzilla Link 41808
Resolution INVALID
Resolved on May 09, 2019 02:41
Version 8.0
OS Linux
CC @zygoloid,@TNorthover

Extended Description

In the clang --help output you can see: -save-temps= Save intermediate compilation results. -save-temps Save intermediate compilation results

But when you try to use -save-temps (without the =)

error: unknown argument '-save-temps', did you mean '-save-temps='?

pmatos commented 5 years ago

I'm afraid I don't understand the question. Could you clarify?

Apologies, you didn't understand because I made no sense. Actually what I suggested does not work. I was suggesting forwarding the user to clang -cc1 -help when necessary but that's not possible because clang doesn't know what the user needs.

It's a bit of a tragedy that -cc1 changes the help list but I am actually not sure something can be done here. Thanks for your time.

TNorthover commented 5 years ago

I'm afraid I don't understand the question. Could you clarify?

pmatos commented 5 years ago

Well shouldn't clang -cc1 be show clang -cc1 -help instead then?

TNorthover commented 5 years ago

OK, "clang -cc1" takes different options from the Clang driver by design then. It even has a separate help list ("clang -cc1 -help") which doesn't include the bare -save-temps option.

So I think this is all behaving as intended.

pmatos commented 5 years ago

Correct.

/home/pmatos/installs/bin/clang-8 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name UnifiedSource-3a3c4ec0-1.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -ffp-contract=off -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /home/pmatos/installs/lib/clang/8.0.1 -D BUILDING_JSCONLY__ -D BUILDING_JavaScriptCore -D BUILDING_WITH_CMAKE=1 -D HAVE_CONFIG_H=1 -D JavaScriptCore_EXPORTS -D STATICALLY_LINKED_WITH_WTF -I DerivedSources/ForwardingHeaders -I . -I ../Source/JavaScriptCore -I ../Source/JavaScriptCore/API -I ../Source/JavaScriptCore/assembler -I ../Source/JavaScriptCore/b3 -I ../Source/JavaScriptCore/b3/air -I ../Source/JavaScriptCore/bindings -I ../Source/JavaScriptCore/builtins -I ../Source/JavaScriptCore/bytecode -I ../Source/JavaScriptCore/bytecompiler -I ../Source/JavaScriptCore/dfg -I ../Source/JavaScriptCore/disassembler -I ../Source/JavaScriptCore/disassembler/ARM64 -I ../Source/JavaScriptCore/disassembler/udis86 -I ../Source/JavaScriptCore/domjit -I ../Source/JavaScriptCore/ftl -I ../Source/JavaScriptCore/heap -I ../Source/JavaScriptCore/debugger -I ../Source/JavaScriptCore/inspector -I ../Source/JavaScriptCore/inspector/agents -I ../Source/JavaScriptCore/inspector/augmentable -I ../Source/JavaScriptCore/inspector/remote -I ../Source/JavaScriptCore/interpreter -I ../Source/JavaScriptCore/jit -I ../Source/JavaScriptCore/llint -I ../Source/JavaScriptCore/parser -I ../Source/JavaScriptCore/profiler -I ../Source/JavaScriptCore/runtime -I ../Source/JavaScriptCore/tools -I ../Source/JavaScriptCore/wasm -I ../Source/JavaScriptCore/wasm/js -I ../Source/JavaScriptCore/yarr -I DerivedSources/JavaScriptCore -I DerivedSources/JavaScriptCore/inspector -I DerivedSources/JavaScriptCore/runtime -I DerivedSources/JavaScriptCore/yarr -I ../Source/bmalloc -I DerivedSources -I ../Source/ThirdParty -D NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward -internal-isystem /usr/local/include -internal-isystem /home/pmatos/installs/lib/clang/8.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-expansion-to-defined -Wno-attributes -Wno-psabi -Wno-noexcept-type -Wno-maybe-uninitialized -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/pmatos/Projects/Igalia/WebKit/WebKitBuild -ferror-limit 19 -fmessage-length 0 -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config crosscheck-with-z3=true -o /home/pmatos/Projects/Igalia/WebKit/WebKitBuild/build-analysis_z3/scan-build-2019-05-09-09-46-21-907905-qrljzo0e -x c++ /home/pmatos/Projects/Igalia/WebKit/WebKitBuild/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource-3a3c4ec0-1.cpp -faddrsig -save-temps

does not work.

But /home/pmatos/installs/bin/clang-8 --help will show the -save-temps option.

TNorthover commented 5 years ago

Are you trying to pass that option to a "clang -cc1" invocation?

-save-temps is a driver-level option that causes multiple invocations of the underlying clang binary (first preprocess, then emit ir, then compile the IR).