summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-10-26 01:08:55 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-10-26 01:08:55 +0000
commit15881ed009b0c1381340718565198a939312c1f3 (patch)
tree5d17c56f32e53b6726cae23b16fe4e7dffea23f8 /clang/lib/Lex/ModuleMap.cpp
parent2241b84f4808f84a513fd9c27246877198d13c16 (diff)
downloadbcm5719-llvm-15881ed009b0c1381340718565198a939312c1f3.tar.gz
bcm5719-llvm-15881ed009b0c1381340718565198a939312c1f3.zip
Treat module headers wrapped by our builtin headers as implicitly being textual
headers. We previously got this check backwards and treated the wrapper header as being textual. This is important because our wrapper headers sometimes inject macros into the system headers that they #include_next, and sometimes replace them entirely. llvm-svn: 285152
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 6a261a11548..2b6b78aceec 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -1881,16 +1881,20 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken,
Module::Header H = {RelativePathName.str(), File};
Map.excludeHeader(ActiveModule, H);
} else {
- // If there is a builtin counterpart to this file, add it now as a textual
- // header, so it can be #include_next'd by the wrapper header, and can
- // receive macros from the wrapper header.
+ // If there is a builtin counterpart to this file, add it now so it can
+ // wrap the system header.
if (BuiltinFile) {
// FIXME: Taking the name from the FileEntry is unstable and can give
// different results depending on how we've previously named that file
// in this build.
Module::Header H = { BuiltinFile->getName(), BuiltinFile };
- Map.addHeader(ActiveModule, H, ModuleMap::ModuleHeaderRole(
- Role | ModuleMap::TextualHeader));
+ Map.addHeader(ActiveModule, H, Role);
+
+ // If we have both a builtin and system version of the file, the
+ // builtin version may want to inject macros into the system header, so
+ // force the system header to be treated as a textual header in this
+ // case.
+ Role = ModuleMap::ModuleHeaderRole(Role | ModuleMap::TextualHeader);
}
// Record this header.
OpenPOWER on IntegriCloud