r211504 - Stop sharing the FileManager in ASTUnit::Parse

Ben Langmuir blangmuir at apple.com
Mon Jun 23 09:36:40 PDT 2014


Author: benlangmuir
Date: Mon Jun 23 11:36:40 2014
New Revision: 211504

URL: http://llvm.org/viewvc/llvm-project?rev=211504&view=rev
Log:
Stop sharing the FileManager in ASTUnit::Parse

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.

Modified:
    cfe/trunk/lib/Frontend/ASTUnit.cpp

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=211504&r1=211503&r2=211504&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Jun 23 11:36:40 2014
@@ -1089,7 +1089,13 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *
   // 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();





More information about the cfe-commits mailing list