diff --git a/clang_delta/Transformation.cpp b/clang_delta/Transformation.cpp index b350eec5..707a0209 100644 --- a/clang_delta/Transformation.cpp +++ b/clang_delta/Transformation.cpp @@ -95,7 +95,7 @@ void Transformation::Initialize(ASTContext &context) void Transformation::outputTransformedSource(llvm::raw_ostream &OutStream) { FileID MainFileID = SrcManager->getMainFileID(); - const RewriteBuffer *RWBuf = TheRewriter.getRewriteBufferFor(MainFileID); + const llvm::RewriteBuffer *RWBuf = TheRewriter.getRewriteBufferFor(MainFileID); // RWBuf is non-empty upon any rewrites TransAssert(RWBuf && "Empty RewriteBuffer!"); diff --git a/clang_delta/TransformationManager.cpp b/clang_delta/TransformationManager.cpp index 79b17cee..e16e07ce 100644 --- a/clang_delta/TransformationManager.cpp +++ b/clang_delta/TransformationManager.cpp @@ -24,6 +24,7 @@ #include "clang/Lex/PreprocessorOptions.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Parse/ParseAST.h" +#include "llvm/Support/VirtualFileSystem.h" // For llvm::vfs::get GlobalVirtualFileSystem() #include "Transformation.h" @@ -90,8 +91,14 @@ bool TransformationManager::initializeCompilerInstance(std::string &ErrorMsg) ClangInstance = new CompilerInstance(); assert(ClangInstance); - + +#if LLVM_VERSION_MAJOR >= 20 + // Get the global virtual file system + auto VFS = llvm::vfs::getRealFileSystem(); + ClangInstance->createDiagnostics(*VFS); +#else ClangInstance->createDiagnostics(); +#endif TargetOptions &TargetOpts = ClangInstance->getTargetOpts(); PreprocessorOptions &PPOpts = ClangInstance->getPreprocessorOpts();