Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VisitDecl vs. TraverseDecl (Clang RecursiveASTVisitor)

I've read this link but still don't fully understand what's the difference between TraverseDecl and VisitDecl (and their use case) http://clang.llvm.org/doxygen/classclang_1_1RecursiveASTVisitor.html

Which method should I be overriding when writing my RecursiveASTVisitor?

like image 385
Jeremy Kuah Avatar asked Jun 14 '16 04:06

Jeremy Kuah


1 Answers

TraverseDecl tells the frontend library's ASTConsumer to visit declarations recursively from the AST. Then VisitDecl is called where you can extract the relevant information.

Follow these two links for more details and a simple checker example:

http://clang.llvm.org/docs/RAVFrontendAction.html

How to traverse clang AST manually ?

like image 154
Nishant Sharma Avatar answered Nov 03 '22 05:11

Nishant Sharma