diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp | 23 | 
1 files changed, 9 insertions, 14 deletions
diff --git a/contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp b/contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp index 704d51509851..12226b231417 100644 --- a/contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp +++ b/contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp @@ -633,18 +633,12 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,      return true;    } -  if (!CI.hasVirtualFileSystem()) { -    if (IntrusiveRefCntPtr<vfs::FileSystem> VFS = -          createVFSFromCompilerInvocation(CI.getInvocation(), -                                          CI.getDiagnostics())) -      CI.setVirtualFileSystem(VFS); -    else +  // Set up the file and source managers, if needed. +  if (!CI.hasFileManager()) { +    if (!CI.createFileManager()) {        goto failure; +    }    } - -  // Set up the file and source managers, if needed. -  if (!CI.hasFileManager()) -    CI.createFileManager();    if (!CI.hasSourceManager())      CI.createSourceManager(CI.getFileManager()); @@ -754,10 +748,11 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,          goto failure;        // Reinitialize the main file entry to refer to the new input. -      if (!CI.InitializeSourceManager(FrontendInputFile( -              Buffer.release(), Input.getKind().withFormat(InputKind::Source), -              CurrentModule->IsSystem))) -        goto failure; +      auto Kind = CurrentModule->IsSystem ? SrcMgr::C_System : SrcMgr::C_User; +      auto &SourceMgr = CI.getSourceManager(); +      auto BufferID = SourceMgr.createFileID(std::move(Buffer), Kind); +      assert(BufferID.isValid() && "couldn't creaate module buffer ID"); +      SourceMgr.setMainFileID(BufferID);      }    }  | 
