[cfe-dev] Usage of pragma directives
cdavis at mymail.mines.edu
Sat Feb 27 00:19:56 PST 2010
kalyan ponnala wrote:
> I would like to know Clang pragmas usage (poison, system_header etc).
Huh? I don't think I understand what you're asking. Please explain.
> And is there any way to define pragmas of our own.
Yeah. What you want to do is define a PragmaHandler (that is, derive a
class from PragmaHandler), and implement the HandlePragma() method.
Then, you can register the PragmaHandler by calling the
AddPragmaHandler() of the Preprocessor object.
You can add your own pragma namespace by creating a PragmaNamespace
object (itself a PragmaHandler), then populating it with your custom
You can even handle any pragma not otherwise handled by registering a
PragmaHandler whose identifier is null.
More information about the cfe-dev