如何在没有消费者的情况下手动遍历clang AST树(C ++ clang API)?

时间:2014-06-10 14:15:21

标签: c++ api clang

我有以下结构:

AAA* classA = new AAA;
classA->functionA()->functionB()->functionC();

我有一个“CXXMemberCallExpr(或FunctionDecl)”到“functionC()”,它具有以下结构:

|-CXXMemberCallExpr 0x11c2538 <line:117:5, col:49> 'class AAA *'
| `-MemberExpr 0x11c2514 <col:5, col:39> '<bound member function type>' ->functionC 0x11c0cf0
|   `-CXXMemberCallExpr 0x11c24f8 <col:5, col:36> 'class AAA *'
|     `-MemberExpr 0x11c24d4 <col:5, col:26> '<bound member function type>' ->functionB 0x11c0c60
|       `-CXXMemberCallExpr 0x11c24b8 <col:5, col:23> 'class AAA *'
|         `-MemberExpr 0x11c2494 <col:5, col:13> '<bound member function type>' ->functionA 0x11c0bd0
|           `-ImplicitCastExpr 0x11c2488 <col:5> 'class AAA *' <LValueToRValue>
|             `-DeclRefExpr 0x11c2470 <col:5> 'class AAA *' lvalue Var 0x11c2040 'classA' 'class AAA *'

问题:如何在没有消费者的情况下手动遍历clang AST树?如果我在“functionC”上只有“CXXMemberCallExpr(或FunctionDecl)”,那么得到“functionA”和“functionB”?

如果可以,请帮助我。

0 个答案:

没有答案