草庐IT

compilerInstance

全部标签

c++ - 如何将 Clang 置于 C++ 模式?

我正在使用Clang开发AST转换器。它应该将文件名作为输入,对该文件中的代码执行一些转换,然后返回转换后的代码。它基于ahelpfulexamplefromEliBendersky.代码如下:std::stringtransform(std::stringfileName){//CompilerInstancewillholdtheinstanceoftheClangcompilerforus,//managingthevariousobjectsneededtorunthecompiler.CompilerInstancecompilerInstance;compilerInsta

将内存文件添加到Clang CompilerInstance

我正在尝试与Clang创建一个工具,并想知道是否可以将InclageFile从内存注入CompilerInstance预处理器。我的目标是添加一个#include对于我的文件,并将此文件与适当的内容一起动态包含。所以我有一个ASTFrontendAction像这样:classMyFrontendAction:publicASTFrontendAction{virtualboolBeginInvocation(CompilerInstance&ci)override{autobuffer=llvm::MemoryBuffer::getMemBufferCopy(...);ci.createFil