summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-03-06 03:16:27 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-03-06 03:16:27 +0000
commit9d100866f235b792e68b03697c4f7a83ad02e6e8 (patch)
tree35046d64c60a2bf4d5a45ed065bb4999c76e0f4b /clang/test
parent1a1e818b13b11109903140cfaebb64d2ce537237 (diff)
downloadbcm5719-llvm-9d100866f235b792e68b03697c4f7a83ad02e6e8.tar.gz
bcm5719-llvm-9d100866f235b792e68b03697c4f7a83ad02e6e8.zip
Fix crash if a submodule overrides one of its own macros, and add support for
submodule macro overriding within the same top-level module (necessary for the testcase to be remotely reasonable). Incidentally reduces the number of libc++ testsuite regressions with modules enabled from 7 to 6. llvm-svn: 203063
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/Inputs/macros_top.h2
-rw-r--r--clang/test/Modules/Inputs/macros_top_b.h5
-rw-r--r--clang/test/Modules/Inputs/macros_top_c.h2
-rw-r--r--clang/test/Modules/Inputs/module.map2
-rw-r--r--clang/test/Modules/macros2.c6
5 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/macros_top.h b/clang/test/Modules/Inputs/macros_top.h
index 2955471a8fa..10935043e2a 100644
--- a/clang/test/Modules/Inputs/macros_top.h
+++ b/clang/test/Modules/Inputs/macros_top.h
@@ -20,3 +20,5 @@
#define TOP_OTHER_REDEF2 2
#define TOP_OTHER_DEF_RIGHT_UNDEF void
+
+#define TOP_REDEF_IN_SUBMODULES 0
diff --git a/clang/test/Modules/Inputs/macros_top_b.h b/clang/test/Modules/Inputs/macros_top_b.h
new file mode 100644
index 00000000000..cfee17cb587
--- /dev/null
+++ b/clang/test/Modules/Inputs/macros_top_b.h
@@ -0,0 +1,5 @@
+#include "macros_top.h"
+#undef TOP_REDEF_IN_SUBMODULES
+#define TOP_REDEF_IN_SUBMODULES 1
+#undef TOP_REDEF_IN_SUBMODULES
+#define TOP_REDEF_IN_SUBMODULES 2
diff --git a/clang/test/Modules/Inputs/macros_top_c.h b/clang/test/Modules/Inputs/macros_top_c.h
new file mode 100644
index 00000000000..aee82462131
--- /dev/null
+++ b/clang/test/Modules/Inputs/macros_top_c.h
@@ -0,0 +1,2 @@
+#include "macros_top_b.h"
+#undef TOP_REDEF_IN_SUBMODULES
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index 67b3a5a0ebe..c4727d74918 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -23,6 +23,8 @@ module module_private_left { header "module_private_left.h" }
module module_private_right { header "module_private_right.h" }
module macros_top {
header "macros_top.h"
+ explicit module b { header "macros_top_b.h" }
+ explicit module c { header "macros_top_c.h" }
}
module macros_left {
header "macros_left.h"
diff --git a/clang/test/Modules/macros2.c b/clang/test/Modules/macros2.c
index 87b4c97d96d..c4c8059011c 100644
--- a/clang/test/Modules/macros2.c
+++ b/clang/test/Modules/macros2.c
@@ -75,3 +75,9 @@ int n1 = TOP_OTHER_REDEF1; // expected-warning{{ambiguous expansion of macro 'TO
int n2 = TOP_OTHER_REDEF2; // ok
int n3 = TOP_OTHER_DEF_RIGHT_UNDEF; // ok
+
+int top_redef_in_submodules = TOP_REDEF_IN_SUBMODULES;
+@import macros_top.c;
+void test2() {
+ int TOP_REDEF_IN_SUBMODULES = top_redef_in_submodules;
+}
OpenPOWER on IntegriCloud