问题
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