17

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?

4

2 に答える 2

20

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.

于 2013-03-25T13:47:59.143 に答える
8

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).

于 2016-01-25T12:36:05.240 に答える