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
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();
}
--- /dev/null
+// RUN: rm -rf %t && mkdir %t
+// RUN: echo 'module Foo { header "foo.h" }' > %t/module.modulemap
+// RUN: echo '#define FOO_MACRO 42' > %t/foo.h
+// RUN: c-index-test -code-completion-at=%s:9:1 -I %t %s | FileCheck %s
+// RUN: c-index-test -code-completion-at=%s:9:1 -I %t -fmodules %s | FileCheck %s
+
+#include "foo.h"
+int x =
+/*here*/1;
+
+// CHECK: FOO_MACRO
--- /dev/null
+// RUN: rm -rf %t && mkdir %t
+// RUN: echo 'module Foo { header "foo.h" }' > %t/module.modulemap
+// RUN: echo '#define FOO_MACRO 42' > %t/foo.h
+// RUN: c-index-test -code-completion-at=%s:8:1 -I %t -fmodules %s | FileCheck %s
+
+@import Foo;
+int x =
+/*here*/1;
+
+// CHECK: FOO_MACRO