소스 검색

[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
Richard Smith 10 년 전
부모
커밋
b4742f0fba
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      lib/Lex/PPLexerChange.cpp

+ 5 - 2
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;
       }
     }