[cfe-dev] Extra parameters to Traverse* functions in ASTVisitor

Saswat Padhi padhi at cs.ucla.edu
Sun Apr 26 23:04:26 PDT 2015


Hello everyone,

I am new to Clang and am trying to build a Static Checker for one of my projects. I am currently using a RecursiveASTVisitor to walk through the AST. But I also need to pass some state to the Traverse* functions, while walking through the AST. For example, when I call TraverseStmt recursively, I need to pass some extra arguments, but the Traverse* functions only accept single arguments. Is there any way I could achieve this?

I can keep a local stack within the ASTVisitor, but I was wondering if there would be a cleaner way to do it.

Thanks,
Saswat



More information about the cfe-dev mailing list