summaryrefslogtreecommitdiffstats
path: root/test/CodeCompletion
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2015-06-24 19:27:02 +0000
committerJordan Rose <jordan_rose@apple.com>2015-06-24 19:27:02 +0000
commit096560832fb493d875541c67895eb8a8620b68ed (patch)
tree326174cd5008ceadaca19460a2a3c3e75a072b5b /test/CodeCompletion
parent13e2ca85e71f1bff6012e802b3a9501def8fc7d5 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeCompletion')
-rw-r--r--test/CodeCompletion/macros-in-modules.c11
-rw-r--r--test/CodeCompletion/macros-in-modules.m10
2 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeCompletion/macros-in-modules.c b/test/CodeCompletion/macros-in-modules.c
new file mode 100644
index 0000000000..82ffaae7cb
--- /dev/null
+++ b/test/CodeCompletion/macros-in-modules.c
@@ -0,0 +1,11 @@
+// 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
diff --git a/test/CodeCompletion/macros-in-modules.m b/test/CodeCompletion/macros-in-modules.m
new file mode 100644
index 0000000000..8d6b3753d0
--- /dev/null
+++ b/test/CodeCompletion/macros-in-modules.m
@@ -0,0 +1,10 @@
+// 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