lang语AST解释 [英] Clang AST Interpretation

查看:89
本文介绍了lang语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!

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

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