]> granicus.if.org Git - clang/commitdiff
Retain all hidden methods in the global method pool, because they may become visible...
authorDouglas Gregor <dgregor@apple.com>
Thu, 7 Feb 2013 19:13:24 +0000 (19:13 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 7 Feb 2013 19:13:24 +0000 (19:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174648 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/Modules/Inputs/MethodPoolASub.h
test/Modules/Inputs/MethodPoolBSub.h
test/Modules/Inputs/module.map
test/Modules/method_pool.m

index 0b09697a8f6ee3aaa6836f0f005f4acabd4b9940..43b097d1f2b14b4dc5fbe0dabbd5a1966bbfa9b5 100644 (file)
@@ -2045,6 +2045,10 @@ bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *left,
                   left->getResultType(), right->getResultType()))
     return false;
 
+  // If either is hidden, it is not considered to match.
+  if (left->isHidden() || right->isHidden())
+    return false;
+
   if (getLangOpts().ObjCAutoRefCount &&
       (left->hasAttr<NSReturnsRetainedAttr>()
          != right->hasAttr<NSReturnsRetainedAttr>() ||
index e0bd238567b677bd585506c3dba2f428b517fbe0..0b36dfa66005b83cb95a2d913750bd7f5f094d1e 100644 (file)
@@ -1,3 +1,4 @@
 @interface A (Sub)
 - (char)method3;
+- (char*)method4;
 @end
index 3404ce91fa6d1b4a6757c720f8c99c3cb191fe74..0a7899df81b79d6e34db042907d3090a1e500935 100644 (file)
@@ -1,3 +1,4 @@
 @interface B (Sub)
 - (char *)method3;
+- (char*)method4;
 @end
index 234bfcc2b0fc98a8575026390ba6955a92937258..499dcba27994ff209821d214d64e1e94271227ad 100644 (file)
@@ -116,6 +116,10 @@ module templates_right {
 module MethodPoolA {
   header "MethodPoolA.h"
 
+  explicit module Sub2 {
+    header "MethodPoolASub2.h"
+  }
+
   explicit module Sub {
     header "MethodPoolASub.h"
   }
index 1b94efb79f9f9adda5110840628b598e36f7845f..712e55d4d647e405ec580a81d3644bc7dfbf4dfb 100644 (file)
@@ -19,6 +19,10 @@ void testMethod2(id object) {
   [object method2:1];
 } 
 
+void testMethod4(id object) {
+  [object method4]; // expected-warning{{instance method '-method4' not found (return type defaults to 'id')}}
+} 
+
 @import MethodPoolB;
 
 void testMethod1Again(id object) {
@@ -46,3 +50,7 @@ void testMethod3AgainAgain(id object) {
   // expected-note@2{{using}}
   // expected-note@2{{also found}}
 }
+
+void testMethod4Again(id object) {
+  [object method4];
+}