[cfe-dev] relating preprocessing information to syntax trees

Dietmar Ebner ebner at complang.tuwien.ac.at
Thu Apr 9 11:42:12 PDT 2009


Hello,

I'm working on a small path that dumps clang ASTs in a prolog term 
representation. The format is closely related to ROSE [1] syntax trees 
(there's a one-to-one correspondence). One of the goals is 
source-to-source translation. Therefore, preprocessing information has 
to be properly annotated at the immediately succeeding declaration.

I'm thus looking for a proper way to relate preprocessing information 
such as define or include directives and pragmas to nodes in the syntax 
tree. A quick hack would be to use the annotated source locations, but I 
don't particularly like this solution. Any advice would be greatly 
appreciated. Sorry if this is a trivial question, I'm fairly new to clang.

Best,

-
Dietmar

[1] http://rosecompiler.org/



More information about the cfe-dev mailing list