我需要将新节点插入 AST。例如,向函数添加命名空间:
转这个——
void foo();
进入这个 -
namespace bar {
void foo();
}
我读了How to clone or create an AST Stmt node of clang?但我不喜欢使用源到源编译
肿瘤坏死因子
最佳答案
答案可以在这里找到
http://clang-developers.42468.n3.nabble.com/Adding-nodes-to-Clang-s-AST-td4054800.html
但是,节点会添加到 编译 AST - 例如,如果想将命名空间注入(inject)代码,他不能直接通过代码使用命名空间,因为词法分析器不知道它。
关于clang - 向 Clang 的 AST 添加节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41550891/