diff --git a/src/indexer.cc b/src/indexer.cc index bdeead98..a16fd12c 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -1239,12 +1239,17 @@ Index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, DiagnosticConsumer DC; auto Clang = std::make_unique(PCH); Clang->setInvocation(std::move(CI)); - Clang->setVirtualFileSystem(FS); Clang->createDiagnostics(&DC, false); Clang->setTarget(TargetInfo::CreateTargetInfo( Clang->getDiagnostics(), Clang->getInvocation().TargetOpts)); if (!Clang->hasTarget()) return {}; +#if LLVM_VERSION_MAJOR >= 9 // rC357037 + Clang->createFileManager(FS); +#else + Clang->setVirtualFileSystem(FS); + Clang->createFileManager(); +#endif IndexParam param(*vfs, no_linkage); auto DataConsumer = std::make_shared(param); diff --git a/src/sema_manager.cc b/src/sema_manager.cc index 0791c59c..8ebdca0a 100644 --- a/src/sema_manager.cc +++ b/src/sema_manager.cc @@ -296,7 +296,6 @@ std::unique_ptr BuildCompilerInstance( auto Clang = std::make_unique(session.PCH); Clang->setInvocation(std::move(CI)); - Clang->setVirtualFileSystem(FS); Clang->createDiagnostics(&DC, false); Clang->setTarget(TargetInfo::CreateTargetInfo( Clang->getDiagnostics(), Clang->getInvocation().TargetOpts)); @@ -305,7 +304,12 @@ std::unique_ptr BuildCompilerInstance( // Construct SourceManager with UserFilesAreVolatile: true because otherwise // RequiresNullTerminator: true may cause out-of-bounds read when a file is // mmap'ed but is saved concurrently. +#if LLVM_VERSION_MAJOR >= 9 // rC357037 + Clang->createFileManager(FS); +#else + Clang->setVirtualFileSystem(FS); Clang->createFileManager(); +#endif Clang->setSourceManager(new SourceManager(Clang->getDiagnostics(), Clang->getFileManager(), true)); auto &IS = Clang->getFrontendOpts().Inputs;