aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 5709e7a..02994bce 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1360,10 +1360,17 @@ static bool compileModule(CompilerInstance &ImportingInstance,
StringRef ModuleMapFilePath = ModuleMapFile->getNameAsRequested();
+ // Use the systemness of the module map as parsed instead of using the
+ // IsSystem attribute of the module. If the module has [system] but the
+ // module map is not in a system path, then this would incorrectly parse
+ // any other modules in that module map as system too.
+ const SrcMgr::SLocEntry &SLoc = SourceMgr.getSLocEntry(ModuleMapFID);
+ bool IsSystem = isSystem(SLoc.getFile().getFileCharacteristic());
+
// Use the module map where this module resides.
Result = compileModuleImpl(
ImportingInstance, ImportLoc, Module->getTopLevelModuleName(),
- FrontendInputFile(ModuleMapFilePath, IK, +Module->IsSystem),
+ FrontendInputFile(ModuleMapFilePath, IK, IsSystem),
ModMap.getModuleMapFileForUniquing(Module)->getName(), ModuleFileName);
} else {
// FIXME: We only need to fake up an input file here as a way of