Clang AST 解释 [英] Clang AST Interpretation

查看:55
本文介绍了Clang AST 解释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解释您可以在下图中看到的 Clang AST 的部分内容.简而言之,我想做的是检查两个变量在不同的程序点是否相同.检查 AST 后,我注意到 AST 部分之间唯一的共同点是蓝色圈出的部分.

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.

谁能帮助我了解这些十六进制数字在 AST 中对应的内容?我知道第一个块对应一个变量声明,第二个块对应一个表达式.是否有 Stmt 和 Expr 类上的方法可以调用来获取这些十六进制数?

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?

推荐答案

那些确实是原始指针值.

Those are indeed raw pointer values.

您很可能需要检查 DeclRefExpr 节点及其引用的相应声明(即 getDecl 方法).指向其声明的指针是您要查找的十六进制数.

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.

使用 Clang 进行愉快的黑客攻击!

Happy hacking with Clang!

这篇关于Clang AST 解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆