diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-02 01:14:40 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-02 01:14:40 +0000 |
commit | b4742f0fba0a0c8d2f15c9ab827487d752634e01 (patch) | |
tree | 04beb50f07c557731163a673c3b0d70a38a2941d /lib/Lex/PPLexerChange.cpp | |
parent | d3728ad0ed926320f82c65404a2c7e1fe3c8aa52 (diff) |
[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
Diffstat (limited to 'lib/Lex/PPLexerChange.cpp')
-rw-r--r-- | lib/Lex/PPLexerChange.cpp | 7 |
1 files 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; } } |