summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPLexerChange.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-05-02 00:45:56 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-05-02 00:45:56 +0000
commit38477db8c4a0bfddb7c749de2de50ccd47d4ef54 (patch)
treec521354f8853fe82d7105e7f5e4114d19c25877a /clang/lib/Lex/PPLexerChange.cpp
parentae4c2649dce019d431b7f8e231d6f198bcab8bdf (diff)
downloadbcm5719-llvm-38477db8c4a0bfddb7c749de2de50ccd47d4ef54.tar.gz
bcm5719-llvm-38477db8c4a0bfddb7c749de2de50ccd47d4ef54.zip
[modules] If a module #includes a modular header that #undef's its macro, it
should not export the macro. ... at least, not unless we have local submodule visibility enabled. llvm-svn: 236369
Diffstat (limited to 'clang/lib/Lex/PPLexerChange.cpp')
-rw-r--r--clang/lib/Lex/PPLexerChange.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp
index c506aa7f6f0..d4defdd71a7 100644
--- a/clang/lib/Lex/PPLexerChange.cpp
+++ b/clang/lib/Lex/PPLexerChange.cpp
@@ -620,8 +620,7 @@ void Preprocessor::EnterSubmodule(Module *M, SourceLocation ImportLoc) {
// Determine the set of starting macros for this submodule.
// FIXME: If we re-enter a submodule, should we restore its MacroDirectives?
- auto &StartingMacros = (getLangOpts().ModulesLocalVisibility &&
- BuildingSubmoduleStack.size() > 1)
+ auto &StartingMacros = getLangOpts().ModulesLocalVisibility
? BuildingSubmoduleStack[0].Macros
: Info.Macros;
@@ -661,13 +660,13 @@ void Preprocessor::LeaveSubmodule() {
MD = MD->getPrevious()) {
assert(MD && "broken macro directive chain");
- // Skip macros defined in other submodules we #included along the way.
+ // Stop on macros defined in other submodules we #included along the way.
// There's no point doing this if we're tracking local submodule
- // visibiltiy, since there can be no such directives in our list.
+ // visibility, since there can be no such directives in our list.
if (!getLangOpts().ModulesLocalVisibility) {
Module *Mod = getModuleContainingLocation(MD->getLocation());
if (Mod != Info.M)
- continue;
+ break;
}
if (auto *VisMD = dyn_cast<VisibilityMacroDirective>(MD)) {
OpenPOWER on IntegriCloud