[cfe-dev] Pragmas.

Eli Friedman eli.friedman at gmail.com
Sat Jun 27 04:13:42 PDT 2009

On Sat, Jun 27, 2009 at 3:37 AM, <Sanjiv.Gupta at microchip.com> wrote:
>> Each pragma needs special support from the compiler; what are you trying
>> to do?
>> -Eli
> I want the frontend to allow following
> #pragma config blah, blah, blah
> The backend should be able to see this as it is, and will emit some special
> section to place this blah,blah info into.

Hmm... to make clang able to recognize something like that, you need a
hook in the parser for the pragma, a new declaration kind in the AST,
a new method on Action, and an implementation of that method in Sema
to add the declaration to the AST.

How to represent it in the AST and how to deal with it for CodeGen
depends on what exactly goes into the "blah, blah, blah".  We want to
keep the AST and the IR as structured as possible, so I'd like to
avoid adding a mechanism to dump an opaque string onto the backend.
If you really need to pass stuff through to the assembler, we already
support module-level asm statements.


More information about the cfe-dev mailing list