Reputation: 1140
I am trying to understand an existing pass in LLVM and thus trying to print the nicely written debug messages in the pass. I am doing so by using clang -debug -some-other-flags
. However while compiling it says:
clang: warning: argument unused during compilation: '-debug'
How to enable the debug output?
Upvotes: 20
Views: 13124
Reputation: 1820
In case the accepted answer does not work for you: apart from adding -mllvm -debug
, you need clang which is built with debug assertions enabled, which is done by adding -DLLVM_ENABLE_ASSERTIONS=On
to cmake options when compiling clang (ref).
Upvotes: 8
Reputation: 26868
Clang does not have a "debug" command-line option; you need to either build the IR from clang and then run opt -debug
separately, or run clang -mllvm -debug
.
In general, the -mllvm
flag passes whatever appears afterwards on to LLVM itself. Use multiple -mllvm
flags if you want to pass multiple options onwards.
Upvotes: 26