From: Nick Lewycky Date: Thu, 12 Apr 2012 07:56:21 +0000 (+0000) Subject: There's some code in the PCH reader that looks like it's needlessly complex, but X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f33d549b16a4d2f7325a099eee0ab7ee50c9528f;p=clang 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 --- 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