Fix a use-after-free bug I recently introduced in lookupModuleFile

llvm-svn: 207932
This commit is contained in:
Ben Langmuir
2014-05-04 05:20:54 +00:00
parent 1b1256a1b1
commit 027731d7b5

View File

@@ -390,11 +390,10 @@ bool ModuleManager::lookupModuleFile(StringRef FileName,
}
if ((ExpectedSize && ExpectedSize != File->getSize()) ||
(ExpectedModTime && ExpectedModTime != File->getModificationTime())) {
FileMgr.invalidateCache(File);
File = nullptr;
(ExpectedModTime && ExpectedModTime != File->getModificationTime()))
// Do not destroy File, as it may be referenced. If we need to rebuild it,
// it will be destroyed by removeModules.
return true;
}
return false;
}