From b4742f0fba0a0c8d2f15c9ab827487d752634e01 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sat, 2 May 2015 01:14:40 +0000 Subject: [PATCH] [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 --- lib/Lex/PPLexerChange.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; } } -- 2.50.1