[cfe-dev] traversing the AST

Stefan Seefeld stefan.seefeld at gmail.com
Thu Mar 18 09:54:32 PDT 2010


Doug,

thanks for the clarification on invalid source locations. May I assume 
that whenever the filename is 0, the location corresponds to "builtin", 
i.e. injected code, preceding the actual source code ?

I'v got a little further now. Using clang_visitChildren() on a file 
containing "int i;" will report a cursor with kind CXCursor_VarDecl, 
where the location corresponds to the position after the declarator "i" 
(and the spelling yields the declarator itself).
Is that intended ? I wonder what "VarDecl" stands for, Declarator, or 
Declaration. If this really reports the declarator, how can I access the 
(full) declaration. Why is this not directly visited via 
clang_visitChildren() ?

More generally, what entities does clang_visitChildren() report, and, 
assuming this is just a subset of the full AST, how may I access the rest ?

I'm sorry to come up with all those entry-level questions. Perhaps there 
is some documentation available, which I haven't found yet.

Thanks for your help !

         Stefan

-- 

       ...ich hab' noch einen Koffer in Berlin...




More information about the cfe-dev mailing list