[cfe-dev] Pragma information in AST processing
Peter Thoman
peter.thoman at uibk.ac.at
Tue Jun 9 04:02:05 PDT 2009
Hi, this is my first post to the list.
For what I'm currently working on I'd like to use some information
extracted from pragmas in an AST visiting/transformation pass. Since (as
far as I can see) pragma information is only available in the
preprocessing pass I currently see 2 ways of doing this, both using
PragmaHandlers in the preprocessor:
(1) collect a list of the pragmas, their information and the associated
source locations during preprocessing, then in the AST visitor check if
we are at a location on a line directly after some pragma and if so
process based on the information collected previously
(2) rewrite the pragmas to some dummy function call, which will be
visible in the AST and can be used for further processing during AST
traversal
Neither of these options seems particularly clean to me so I would
appreciate if someone who is more experienced with clang can think of a
better solution. Otherwise I'll go ahead with the first option.
Cheers,
Peter
More information about the cfe-dev
mailing list