如何使用 Clang 的 AST? [英] How to make use of Clang's AST?

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

问题描述

我正在考虑将 Clang 的 AST 用于我的 C 代码,并对 AST 进行一些分析.关于从哪里开始、如何获得 Clang 的 AST、教程或这方面的任何内容的一些指示将有很大帮助!!!

I am looking at making use of the Clang's AST for my C code and do some analysis over the AST. Some pointers on where to start, how to obtain the Clang's AST, tutorials or anything in this regard will be of great help!!!

我一直试图找到一些,我得到了这个 link2年前.但由于某种原因,它对我不起作用.教程中的示例代码给了我太多错误.所以我不确定,我是否正确构建了代码,或者教程是否有问题.但我也很乐意从其他页面开始.

I have been trying to find some and I got this link which was created 2 years back. But for some reason, it is not working for me. The sample code, in the tutorial, gives me too many errors. So I am not sure, if I build the code properly or some thing is wrong with the tutorial. But I would be happy to start from some other page as well.

推荐答案

从 sharth 链接的教程开始.然后通过 Clang 的 Doxygen.从 SemaConsumer 开始.

Start with the tutorial linked by sharth. Then go through Clang's Doxygen. Start with SemaConsumer.

阅读大量源代码.Clang 是一个移动的目标.如果您正在基于 clang 编写工具,那么您需要认识到 clang 每天都在添加和修复功能,因此您应该准备好阅读大量代码!

Read a lot of source code. Clang is a moving target. If you are writing tools based on clang, then you need to recognize that clang is adding and fixing features daily, so you should be prepared to read a lot of code!

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

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