summaryrefslogtreecommitdiffstats
path: root/test/Modules
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-04-12 07:56:21 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-04-12 07:56:21 +0000
commitf33d549b16a4d2f7325a099eee0ab7ee50c9528f (patch)
tree3ceb3685ec4b9757703df0a4c9ca318b9d5c7e36 /test/Modules
parentff34d401ff385ef7173ca612432b4ea717fff690 (diff)
There's some code in the PCH reader that looks like it's needlessly complex, but
turns out that it's actually needed for C++ modules support. Since simplifying it didn't cause any test failures, I'll add a test for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154582 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules')
-rw-r--r--test/Modules/Inputs/module.map2
-rw-r--r--test/Modules/Inputs/redecl_namespaces_left.h3
-rw-r--r--test/Modules/Inputs/redecl_namespaces_right.h3
-rw-r--r--test/Modules/redecl-namespaces.mm13
4 files changed, 21 insertions, 0 deletions
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 58dafca097..e8d1f2c666 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -36,6 +36,8 @@ module category_bottom {
module category_other { header "category_other.h" }
module redeclarations_left { header "redeclarations_left.h" }
module redeclarations_right { header "redeclarations_right.h" }
+module redecl_namespaces_left { header "redecl_namespaces_left.h" }
+module redecl_namespaces_right { header "redecl_namespaces_right.h" }
module load_failure { header "load_failure.h" }
module decldef {
diff --git a/test/Modules/Inputs/redecl_namespaces_left.h b/test/Modules/Inputs/redecl_namespaces_left.h
new file mode 100644
index 0000000000..49595eac92
--- /dev/null
+++ b/test/Modules/Inputs/redecl_namespaces_left.h
@@ -0,0 +1,3 @@
+namespace A {
+ int i;
+}
diff --git a/test/Modules/Inputs/redecl_namespaces_right.h b/test/Modules/Inputs/redecl_namespaces_right.h
new file mode 100644
index 0000000000..fdf65baf7a
--- /dev/null
+++ b/test/Modules/Inputs/redecl_namespaces_right.h
@@ -0,0 +1,3 @@
+namespace A {
+ int j;
+}
diff --git a/test/Modules/redecl-namespaces.mm b/test/Modules/redecl-namespaces.mm
new file mode 100644
index 0000000000..e338821564
--- /dev/null
+++ b/test/Modules/redecl-namespaces.mm
@@ -0,0 +1,13 @@
+@__experimental_modules_import redecl_namespaces_left;
+@__experimental_modules_import redecl_namespaces_right;
+
+void test() {
+ A::i;
+ A::j;
+ A::k; // expected-error {{no member named 'k' in namespace 'A'}}
+}
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -emit-module -fmodule-name=redecl_namespaces_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -emit-module -fmodule-name=redecl_namespaces_right %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -w %s -verify