[cfe-dev] How could I visit the same AST?

周书林 via cfe-dev cfe-dev at lists.llvm.org
Tue May 24 06:14:39 PDT 2016


I am learning to visiting ast to collect some information by API of
libTooling.
When I process the source file of postfix-3.0.3/src/global/mail_params.c, I
met something strange.
When I visit the AST by VisitStmt(), I could find that there would be a sub
level of "InitListExpr" in the first level of "InitListExpr" as attachment
shown.


However, when I want to visit the parent AST of StringLiteral by
VisitStringLiteral(), the sub level of "InitListExpr" is gone, I can only
get the higher level "InitListExpr".
I get the parent AST by using
"CompilerInstance.getASTContext().getParents(Stmt*)".
So, how to visit the same AST in these two methods?
Thank you a lot !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160524/52c9bab7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.jpg
Type: image/jpeg
Size: 48134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160524/52c9bab7/attachment.jpg>


More information about the cfe-dev mailing list