regarding user defined pragmas


I want to be able to include a #pragma directive in my C code, run it
through clang and let the directive be available on the LLVM side (as
part of the LLVM IR code) so that I can parse it using a LLVM pass.

Is there any way to do it? Currently, the pragma directive just



Arvind Sudarsanam

Software Engineer

CPU Technology Inc.

1500 Kansas Ave, Suite 3E, Longmont, CO - 80503

Ph: 435-512-7769


My understanding is that you’ll need to add a pragma handler specifically for it (building on the PragmaHandler class). Depending on what the pragma does (assuming it needs to be represented in LLVM IR) you’ll need to create the appropriate representation too.

I’m at the beginning stages of doing the same thing. I hope someone else will chime in if the blind are leading the blind down the wrong path.


see also: