aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 19e284f..500f569 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -172,6 +172,10 @@ void HeaderSearch::getHeaderMapFileNames(
std::string HeaderSearch::getCachedModuleFileName(Module *Module) {
const FileEntry *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)
+ return {};
return getCachedModuleFileName(Module->Name, ModuleMap->getName());
}