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.

llvm-svn: 211504
This commit is contained in:
Ben Langmuir 2014-06-23 16:36:40 +00:00
parent d35f2b902b
commit 2cc485b6a9
1 changed files with 7 additions and 1 deletions

View 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();