r239578 - [modules] Apply name visibility rules to names found by ADL.

Richard Smith richard-llvm at metafoo.co.uk
Thu Jun 11 18:32:14 PDT 2015


Author: rsmith
Date: Thu Jun 11 20:32:13 2015
New Revision: 239578

URL: http://llvm.org/viewvc/llvm-project?rev=239578&view=rev
Log:
[modules] Apply name visibility rules to names found by ADL.

Modified:
    cfe/trunk/lib/Sema/SemaLookup.cpp
    cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h
    cfe/trunk/test/Modules/submodules-merge-defs.cpp

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=239578&r1=239577&r2=239578&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu Jun 11 20:32:13 2015
@@ -3032,6 +3032,9 @@ void Sema::ArgumentDependentLookup(Decla
       if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D))
         continue;
 
+      if (!isVisible(D) && !(D = findAcceptableDecl(*this, D)))
+        continue;
+
       Result.insert(D);
     }
   }

Modified: cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h?rev=239578&r1=239577&r2=239578&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h (original)
+++ cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h Thu Jun 11 20:32:13 2015
@@ -55,3 +55,9 @@ namespace NS {
   template<> struct B<int> : B<int*> {};
   inline void f() {}
 }
+
+namespace StaticInline {
+  struct X {};
+  static inline void f(X);
+  static inline void g(X x) { f(x); }
+}

Modified: cfe/trunk/test/Modules/submodules-merge-defs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodules-merge-defs.cpp?rev=239578&r1=239577&r2=239578&view=diff
==============================================================================
--- cfe/trunk/test/Modules/submodules-merge-defs.cpp (original)
+++ cfe/trunk/test/Modules/submodules-merge-defs.cpp Thu Jun 11 20:32:13 2015
@@ -13,8 +13,8 @@
 
 A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}}
 // expected-note at defs.h:1 +{{here}}
-// FIXME: We should warn that use_a is being used without being imported.
-int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}}
+// expected-note at defs.h:2 +{{here}}
+int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} expected-error {{'use_a' must be imported}}
 
 B::Inner2 pre_bi; // expected-error +{{must be imported}}
 // expected-note at defs.h:4 +{{here}}





More information about the cfe-commits mailing list