[cfe-dev] getting all function calls?
    Joshua Cranmer 
    Pidgeot18 at gmail.com
       
    Thu Jun  9 11:56:09 PDT 2011
    
    
  
On 6/9/2011 11:40 AM, ret val wrote:
> That part I follow. For declarations all Adrien had todo was:
>
> virtual void HandleTranslationUnit(ASTContext &context) {
>             TranslationUnitDecl* tu_decl = 
> context.getTranslationUnitDecl();
>             TraverseDecl(tu_decl);
> }
>
> I would need something like this, but I don't know what I can pull 
> from the context that will be useful. Basically I don't know what the 
> commented out line should look like.
>
> virtual void HandleTranslationUnit(ASTContext &context) {
>             //Stmt *s = context????
>             TraverseStmt(s);
> }
No, what Adrien has is sufficient to traverse statements as well. 
TraverseDecl(tu_decl) will traverse the entire AST, which includes 
statements and expressions. That's why you have the RecursiveASTVisitor: 
it figures out how to visit all of the subchildren for you so you just 
have to worry about implementing VisitStmt and figuring out what to do 
on all of the statements in the file.
-- 
Joshua Cranmer
News submodule owner
DXR coauthor
    
    
More information about the cfe-dev
mailing list