]> granicus.if.org Git - clang/commitdiff
[modules] Make sure we make hidden UsingShadowDecls visible to redeclaration
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 15 Sep 2015 18:51:56 +0000 (18:51 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 15 Sep 2015 18:51:56 +0000 (18:51 +0000)
lookup for the UsingShadowDecls themselves.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247714 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/Lookup.h
test/Modules/Inputs/using-decl-a.h
test/Modules/Inputs/using-decl-b.h
test/Modules/using-decl.cpp

index ed447ba1497596e4a0eb1f07d56affa2b85ad32c..1162a1d65abcb8474e1317006ee7c8bdbdd9c72d 100644 (file)
@@ -240,7 +240,7 @@ public:
     // If a using-shadow declaration is hidden, it's never visible, not
     // even to redeclaration lookup.
     // FIXME: Should this apply to typedefs and namespace aliases too?
-    if (isa<UsingShadowDecl>(ND))
+    if (isa<UsingShadowDecl>(ND) && LookupKind != Sema::LookupUsingDeclName)
       return false;
     return (AllowHidden &&
             (AllowHiddenInternal || ND->isExternallyVisible())) ||
index 85a4788e76473f52cb199749595cf3467a213d94..1d1ffe9ed35081a4785e3309b6125439e7a1a42e 100644 (file)
@@ -1,5 +1,6 @@
 typedef int using_decl_type;
 int using_decl_var;
+int merged;
 
 namespace UsingDecl {
   using ::using_decl_type;
index b4f206fa443126b204c2dfc1390e3e2cf6ae6854..7c03d09960ed7e5e49fde5ad5ba13e428deb833d 100644 (file)
@@ -8,6 +8,7 @@ namespace UsingDecl {
 namespace UsingDecl {
   using ::using_decl_type;
   using ::using_decl_var;
+  using ::merged;
 }
 
 namespace X {
index f01688498c551340c39bd4ff7b7b9e2b32279293..1677585ddafc106019546645ec3721e99ff56c87 100644 (file)
@@ -3,9 +3,15 @@
 // RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -UEARLY_IMPORT
 // RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -DEARLY_IMPORT -fno-modules-hide-internal-linkage
 // RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -UEARLY_IMPORT -fno-modules-hide-internal-linkage
+// RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -DEARLY_IMPORT -fmodules-local-submodule-visibility
+// RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -UEARLY_IMPORT -fmodules-local-submodule-visibility
 
 #ifdef EARLY_IMPORT
 @import using_decl.a;
+namespace UsingDecl {
+  using ::merged;
+}
+int k = UsingDecl::merged;
 #endif
 
 namespace Y {