diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index d4defdd71a7b8c381e20b669527d77d934eb5a79..a27bcd000a406e071211e86b68b8509c82c11eaf 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/lib/Lex/PPLexerChange.cpp @@ -685,8 +685,11 @@ void Preprocessor::LeaveSubmodule() { // FIXME: Issue a warning if multiple headers for the same submodule // define a macro, rather than silently ignoring all but the first. bool IsNew; - addModuleMacro(Info.M, II, Def, Macro.second.getOverriddenMacros(), - IsNew); + // Don't bother creating a module macro if it would represent a #undef + // that doesn't override anything. + if (Def || !Macro.second.getOverriddenMacros().empty()) + addModuleMacro(Info.M, II, Def, Macro.second.getOverriddenMacros(), + IsNew); break; } }