[llvm-dev] Passing arguments to LLVM pass through Clang

Benno Krauss via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 17 00:48:32 PDT 2020


Hello Shishir,

To pass arguments to LLVM from clang, use something like `clang source.c -mllvm -customarg -mllvm argvalue`. The -mllvm argument tells clang to forward the following argument to LLVM. Similarly, there is the -Xclang argument to pass the following argument to clang proper, as opposed to the clang driver.

Cheers,
Benno

Am 16.03.2020 um 23:45 schrieb Shishir V Jessu via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>>:

Hello,

I am adding to an LLVM pass that requires a filename as input. I am able to input this filename as a command line argument when I invoke this pass using opt, but I ultimately need to pass this argument to my code when I compile code with clang.

How can I pass this argument to clang so that I can use it in my LLVM pass? Thanks for your help!

Best,
Shishir Jessu
[https://my-email-signature.link/signature.gif?u=452460&e=89920299&v=06d9a9b1e5d7f6685284ae9f5a944df07b26d3dc9391d3cecc31b2e77d4f5d20] _______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list