From: Richard Smith Date: Sat, 2 May 2015 01:14:40 +0000 (+0000) Subject: [modules] Don't bother creating a ModuleMacro representing a #undef that overrides... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4742f0fba0a0c8d2f15c9ab827487d752634e01;p=clang [modules] Don't bother creating a ModuleMacro representing a #undef that overrides nothing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236374 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index d4defdd71a..a27bcd000a 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; } }