Clang AST Interpretation

独自空忆成欢 提交于 2021-02-05 09:28:16

问题


I am trying to interpret parts of the Clang AST you can see in the picture below. In short I am trying to do is to check if two variables are the same at different program points. After inspecting the AST, I noticed that the only commonality between the AST sections are the sections circled in blue.

Can anyone help me as to what these hex numbers correspond to in the AST? I understand that the first block corresponds to a Variable Declaration and the second block corresponds to a Expression. Are there methods on Stmt and Expr classes which can be invoked to get hold of these hex numbers?


回答1:


Those are indeed raw pointer values.

You most likely need to check DeclRefExpr nodes and their corresponding declarations that they reference (i.e. getDecl method). Pointer to its declaration is the hex number you are looking for.

Happy hacking with Clang!



来源:https://stackoverflow.com/questions/55837605/clang-ast-interpretation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!