How To Pass An Command Line Option To The Pass

Hi all,

I have a problem with passing multiple option(-flag=aaa/bbb) from clang to llvm,
I don't know how to parse it, should I parse it in clang and pass it
to llvm or should I parse it in llvm pass where I use it,
could you help me.

Thanks in advance,
Sevak.

Hi Sevak,

You can use the cl::opt<> template to declare your options inside your LLVM pass. When calling clang, you can then pass options using -mllvm (e.g. clang -mllvm -my-option=1).

Tobias

Hi all,
I have problem with debugging clang, gdb does not stop in function
ParseFrontendArgs, the function works because I wrote errs() and I saw
it in command line,
I also wrote __asm__("int $3") in ParseFrontendArgs but it does not help.

Thanks in advance.

Are you debugging the correct process? Note that invocations of 'clang' without '-cc1' fork/exec 'clang -cc1' to handle front end options.

Tom.

Sevak,

Hi all,
I have problem with debugging clang, gdb does not stop in function
ParseFrontendArgs, the function works because I wrote errs() and I saw
it in command line,
I also wrote __asm__("int $3") in ParseFrontendArgs but it does not help.

Are you debugging the correct process? Note that invocations of 'clang'
without '-cc1' fork/exec 'clang -cc1' to handle front end options.

Use the -### option to see how the compiler proper is being invoked (e.g., clang -S foo.c -o - -###).

Also, make sure you're using a debug build.

Chad