]> granicus.if.org Git - clang/commitdiff
Stop sharing the FileManager in ASTUnit::Parse
authorBen Langmuir <blangmuir@apple.com>
Mon, 23 Jun 2014 16:36:40 +0000 (16:36 +0000)
committerBen Langmuir <blangmuir@apple.com>
Mon, 23 Jun 2014 16:36:40 +0000 (16:36 +0000)
We were using old stat values for any files that had previously been
looked up, leading to badness. There might be a more elegant solution in
invalidating the cache for those file (since we already know which ones
they are), but it seems too likely there are existing references to
them hiding somewhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211504 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/ASTUnit.cpp

index 49487d9975764efa6cedbf29813d3830670ddf08..df50c40773591d2cf287702776f30e80a937b4f5 100644 (file)
@@ -1089,7 +1089,13 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
   // Configure the various subsystems.
   LangOpts = &Clang->getLangOpts();
   FileSystemOpts = Clang->getFileSystemOpts();
-  // Re-use the existing FileManager
+  IntrusiveRefCntPtr<vfs::FileSystem> VFS =
+      createVFSFromCompilerInvocation(Clang->getInvocation(), getDiagnostics());
+  if (!VFS) {
+    delete OverrideMainBuffer;
+    return true;
+  }
+  FileMgr = new FileManager(FileSystemOpts, VFS);
   SourceMgr = new SourceManager(getDiagnostics(), *FileMgr,
                                 UserFilesAreVolatile);
   TheSema.reset();