将节点添加到 Clang 的 AST [英] Adding nodes to Clang's AST
本文介绍了将节点添加到 Clang 的 AST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要向 AST 插入新节点.例如,为函数添加命名空间:转这个 -
I need to insert new nodes to AST. for instance, adding a namespace to a function: Turning this -
void foo();
进入这个 -
namespace bar {
void foo();
}
我阅读了如何克隆或创建clang 的 AST Stmt 节点? 但我不喜欢使用源到源编译
I read How to clone or create an AST Stmt node of clang? but I prefer not using source-to-source compilation
Tnx
推荐答案
可以在这里找到答案http://clang-developer.42468.n3.nabble.com/Adding-nodes-to-Clang-s-AST-td4054800.html
然而,节点被添加到编译 AST - 例如,如果有人想向代码注入命名空间,他不能直接通过代码使用命名空间,因为词法分析器不知道.
However, the nodes are added to the compiled AST - for instance, in case one wants to inject a namespace to the code, he can't use the namespace directly via the code because the lexer don't know about it.
这篇关于将节点添加到 Clang 的 AST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文