diff options
author | Ben Langmuir <blangmuir@apple.com> | 2015-02-12 21:51:31 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2015-02-12 21:51:31 +0000 |
commit | 18dd78a8fd7077398e6c89cc0bee6c144e936408 (patch) | |
tree | 754f7f0585fff5cdc6a3dfe50d811153c2ea4a5a /clang/lib/Lex/HeaderSearch.cpp | |
parent | 39e988c63cf1cb8f68cb6d7e9c70e13e4b6050bc (diff) | |
download | llvm-18dd78a8fd7077398e6c89cc0bee6c144e936408.zip llvm-18dd78a8fd7077398e6c89cc0bee6c144e936408.tar.gz llvm-18dd78a8fd7077398e6c89cc0bee6c144e936408.tar.bz2 |
Mangle the IsSystem bit into the .pcm file name
When mangling the module map path into a .pcm file name, also mangle the
IsSystem bit, which can also depend on the header search paths. For
example, the user may change from -I to -isystem. This can affect
diagnostics in the importing TU.
llvm-svn: 228966
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index d6b255f..f76d851 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -115,11 +115,13 @@ const HeaderMap *HeaderSearch::CreateHeaderMap(const FileEntry *FE) { std::string HeaderSearch::getModuleFileName(Module *Module) { const FileEntry *ModuleMap = getModuleMap().getModuleMapFileForUniquing(Module); - return getModuleFileName(Module->Name, ModuleMap->getName()); + return getModuleFileName(Module->Name, ModuleMap->getName(), + Module->IsSystem); } std::string HeaderSearch::getModuleFileName(StringRef ModuleName, - StringRef ModuleMapPath) { + StringRef ModuleMapPath, + bool IsSystem) { // If we don't have a module cache path, we can't do anything. if (ModuleCachePath.empty()) return std::string(); @@ -147,6 +149,10 @@ std::string HeaderSearch::getModuleFileName(StringRef ModuleName, llvm::hash_code Hash = llvm::hash_combine(DirName.lower(), FileName.lower()); + // Hash the IsSystem bit, since changing search paths can change whether a + // module is considered 'system' or not. + Hash = llvm::hash_combine(Hash, IsSystem); + SmallString<128> HashStr; llvm::APInt(64, size_t(Hash)).toStringUnsigned(HashStr, /*Radix*/36); llvm::sys::path::append(Result, ModuleName + "-" + HashStr.str() + ".pcm"); |