aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2022-10-04 15:08:08 -0700
committerBen Langmuir <blangmuir@apple.com>2022-10-05 13:12:43 -0700
commit5ea78c4113f8d2c8be24152f2dd0cadaea352c9d (patch)
treec0561866efb1c7cbe9b5b5e26ae615ef956c181d /clang/lib/Lex/HeaderSearch.cpp
parent1888dc91ac872146d106de9f8ea73b9148c920ff (diff)
downloadllvm-5ea78c4113f8d2c8be24152f2dd0cadaea352c9d.zip
llvm-5ea78c4113f8d2c8be24152f2dd0cadaea352c9d.tar.gz
llvm-5ea78c4113f8d2c8be24152f2dd0cadaea352c9d.tar.bz2
[clang] Update ModuleMap::getModuleMapFile* to use FileEntryRef
Update SourceManager::ContentCache::OrigEntry to keep the original FileEntryRef, and use that to enable ModuleMap::getModuleMapFile* to return the original FileEntryRef. This change should be NFC for most users of SourceManager::ContentCache, but it could affect behaviour for users of getNameAsRequested such as in compileModuleImpl. I have not found a way to detect that difference without additional functional changes, other than incidental cases like changes from / to \ on Windows so there is no new test. Differential Revision: https://reviews.llvm.org/D135220
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 029be1e..99596b1 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -170,11 +170,11 @@ void HeaderSearch::getHeaderMapFileNames(
}
std::string HeaderSearch::getCachedModuleFileName(Module *Module) {
- const FileEntry *ModuleMap =
+ Optional<FileEntryRef> ModuleMap =
getModuleMap().getModuleMapFileForUniquing(Module);
// The ModuleMap maybe a nullptr, when we load a cached C++ module without
// *.modulemap file. In this case, just return an empty string.
- if (ModuleMap == nullptr)
+ if (!ModuleMap)
return {};
return getCachedModuleFileName(Module->Name, ModuleMap->getName());
}
@@ -211,7 +211,7 @@ std::string HeaderSearch::getPrebuiltModuleFileName(StringRef ModuleName,
}
std::string HeaderSearch::getPrebuiltImplicitModuleFileName(Module *Module) {
- const FileEntry *ModuleMap =
+ Optional<FileEntryRef> ModuleMap =
getModuleMap().getModuleMapFileForUniquing(Module);
StringRef ModuleName = Module->Name;
StringRef ModuleMapPath = ModuleMap->getName();