From a46bfa6b83a9f22466227a9db7f055263fe308a2 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Wed, 24 Jun 2015 19:27:02 +0000 Subject: [Preprocessor] Iterating over all macros should include those from modules. So, iterate over the list of macros mentioned in modules, and make sure those are in the master table. This isn't particularly efficient, but hopefully it's something that isn't done too often. PR23929 and rdar://problem/21480635 llvm-svn: 240571 --- clang/lib/Lex/Preprocessor.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Lex/Preprocessor.cpp') diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 7e33f1ccb48..e2db638a33d 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -286,6 +286,10 @@ Preprocessor::macro_begin(bool IncludeExternalMacros) const { ExternalSource->ReadDefinedMacros(); } + // Make sure we cover all macros in visible modules. + for (const ModuleMacro &Macro : ModuleMacros) + CurSubmoduleState->Macros.insert(std::make_pair(Macro.II, MacroState())); + return CurSubmoduleState->Macros.begin(); } -- cgit v1.2.3