aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-13 23:15:45 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-13 23:15:45 +0000
commit6e975c4517958bcc11c834336d340797356058db (patch)
treee3b9b3a30636d52d700d5e48004d86f24dc7f70a /lib/Lex/HeaderSearch.cpp
parent7ea51d5f0b4a8fc5768d1b4744a556dc756f1b3b (diff)
For modules, use a hash of the compiler version, language options, and
target triple to separate modules built under different conditions. The hash is used to create a subdirectory in the module cache path where other invocations of the compiler (with the same version, language options, etc.) can find the precompiled modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139662 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
-rw-r--r--lib/Lex/HeaderSearch.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp
index 5cf65cbb0d..bc18d0dba7 100644
--- a/lib/Lex/HeaderSearch.cpp
+++ b/lib/Lex/HeaderSearch.cpp
@@ -99,15 +99,24 @@ const HeaderMap *HeaderSearch::CreateHeaderMap(const FileEntry *FE) {
}
const FileEntry *HeaderSearch::lookupModule(StringRef ModuleName,
+ std::string *ModuleFileName,
std::string *UmbrellaHeader) {
// If we don't have a module cache path, we can't do anything.
- if (ModuleCachePath.empty())
+ if (ModuleCachePath.empty()) {
+ if (ModuleFileName)
+ ModuleFileName->clear();
return 0;
-
+ }
+
// Try to find the module path.
llvm::SmallString<256> FileName(ModuleCachePath);
llvm::sys::path::append(FileName, ModuleName + ".pcm");
- if (const FileEntry *ModuleFile = getFileMgr().getFile(FileName))
+ if (ModuleFileName)
+ *ModuleFileName = FileName.str();
+
+ if (const FileEntry *ModuleFile
+ = getFileMgr().getFile(FileName, /*OpenFile=*/false,
+ /*CacheFailure=*/false))
return ModuleFile;
// We didn't find the module. If we're not supposed to look for an