diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-02-08 21:27:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-02-08 21:27:45 +0000 |
commit | dadd85dc0c84e183f6c2fc1af86a5c77c3feb3db (patch) | |
tree | 81ffb1ec27faca0e5f7f29a1a55ea11184dcb622 | |
parent | dd2721842df7d972e75b308a1af47de889e96f6f (diff) | |
download | bcm5719-llvm-dadd85dc0c84e183f6c2fc1af86a5c77c3feb3db.tar.gz bcm5719-llvm-dadd85dc0c84e183f6c2fc1af86a5c77c3feb3db.zip |
Never cache the result of a module file lookup.
llvm-svn: 174744
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Serialization/GlobalModuleIndex.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 9 |
3 files changed, 15 insertions, 8 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 0c5a1fa70aa..ce6572aa1be 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -996,7 +996,8 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, BuildingModule = true; compileModule(*this, ModuleNameLoc, Module, ModuleFileName); - ModuleFile = FileMgr->getFile(ModuleFileName); + ModuleFile = FileMgr->getFile(ModuleFileName, /*OpenFile=*/false, + /*CacheFailure=*/false); if (!ModuleFile && getPreprocessorOpts().FailedModules) getPreprocessorOpts().FailedModules->addFailed(ModuleName); @@ -1079,14 +1080,14 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, << ModuleName << SourceRange(ImportLoc, ModuleNameLoc); ModuleBuildFailed = true; - return ModuleLoadResult(); } compileModule(*this, ModuleNameLoc, Module, ModuleFileName); // Try loading the module again. - ModuleFile = FileMgr->getFile(ModuleFileName); + ModuleFile = FileMgr->getFile(ModuleFileName, /*OpenFile=*/false, + /*CacheFailure=*/false); if (!ModuleFile || ModuleManager->ReadAST(ModuleFileName, serialization::MK_Module, ImportLoc, diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index 5b2ab913fa0..7d34f85fd8b 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -203,7 +203,8 @@ GlobalModuleIndex::GlobalModuleIndex(FileManager &FileMgr, Dependencies(Record.begin() + Idx, Record.begin() + Idx + NumDeps); // Find the file. If we can't find it, ignore it. - const FileEntry *File = FileMgr.getFile(FileName); + const FileEntry *File = FileMgr.getFile(FileName, /*openFile=*/false, + /*cacheFailure=*/false); if (!File) { AnyOutOfDate = true; break; @@ -635,7 +636,9 @@ bool GlobalModuleIndexBuilder::loadModuleFile(const FileEntry *File) { Idx += Length; // Find the imported module file. - const FileEntry *DependsOnFile = FileMgr.getFile(ImportedFile); + const FileEntry *DependsOnFile + = FileMgr.getFile(ImportedFile, /*openFile=*/false, + /*cacheFailure=*/false); if (!DependsOnFile) return true; diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index bc9917b5822..b9f4d888f30 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -25,12 +25,14 @@ using namespace clang; using namespace serialization; ModuleFile *ModuleManager::lookup(StringRef Name) { - const FileEntry *Entry = FileMgr.getFile(Name); + const FileEntry *Entry = FileMgr.getFile(Name, /*openFile=*/false, + /*cacheFailure=*/false); return Modules[Entry]; } llvm::MemoryBuffer *ModuleManager::lookupBuffer(StringRef Name) { - const FileEntry *Entry = FileMgr.getFile(Name); + const FileEntry *Entry = FileMgr.getFile(Name, /*openFile=*/false, + /*cacheFailure=*/false); return InMemoryBuffers[Entry]; } @@ -38,7 +40,8 @@ std::pair<ModuleFile *, bool> ModuleManager::addModule(StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, ModuleFile *ImportedBy, unsigned Generation, std::string &ErrorStr) { - const FileEntry *Entry = FileMgr.getFile(FileName); + const FileEntry *Entry = FileMgr.getFile(FileName, /*openFile=*/false, + /*cacheFailure=*/false); if (!Entry && FileName != "-") { ErrorStr = "file not found"; return std::make_pair(static_cast<ModuleFile*>(0), false); |