]> granicus.if.org Git - clang/commitdiff
There's some code in the PCH reader that looks like it's needlessly complex, but
authorNick Lewycky <nicholas@mxc.ca>
Thu, 12 Apr 2012 07:56:21 +0000 (07:56 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Thu, 12 Apr 2012 07:56:21 +0000 (07:56 +0000)
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

test/Modules/Inputs/module.map
test/Modules/Inputs/redecl_namespaces_left.h [new file with mode: 0644]
test/Modules/Inputs/redecl_namespaces_right.h [new file with mode: 0644]
test/Modules/redecl-namespaces.mm [new file with mode: 0644]

index 58dafca09773ec61e58c248de81d1ae60266bd1f..e8d1f2c666fc6775071f7d515c1b3cb2efd401bb 100644 (file)
@@ -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 (file)
index 0000000..49595ea
--- /dev/null
@@ -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 (file)
index 0000000..fdf65ba
--- /dev/null
@@ -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 (file)
index 0000000..e338821
--- /dev/null
@@ -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