diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-02-07 19:13:24 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-02-07 19:13:24 +0000 |
commit | 7666b03d499819214752ae392efe666ca856d0e7 (patch) | |
tree | ee3ebcd94ce41463b105ae081f643f7b64f376a0 | |
parent | 90b5ac660ef96b9d59dff837e96fd72d0673d7de (diff) |
Retain all hidden methods in the global method pool, because they may become visible <rdar://problem/13172858>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174648 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 4 | ||||
-rw-r--r-- | test/Modules/Inputs/MethodPoolASub.h | 1 | ||||
-rw-r--r-- | test/Modules/Inputs/MethodPoolBSub.h | 1 | ||||
-rw-r--r-- | test/Modules/Inputs/module.map | 4 | ||||
-rw-r--r-- | test/Modules/method_pool.m | 8 |
5 files changed, 18 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 0b09697a8f..43b097d1f2 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -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>() || diff --git a/test/Modules/Inputs/MethodPoolASub.h b/test/Modules/Inputs/MethodPoolASub.h index e0bd238567..0b36dfa660 100644 --- a/test/Modules/Inputs/MethodPoolASub.h +++ b/test/Modules/Inputs/MethodPoolASub.h @@ -1,3 +1,4 @@ @interface A (Sub) - (char)method3; +- (char*)method4; @end diff --git a/test/Modules/Inputs/MethodPoolBSub.h b/test/Modules/Inputs/MethodPoolBSub.h index 3404ce91fa..0a7899df81 100644 --- a/test/Modules/Inputs/MethodPoolBSub.h +++ b/test/Modules/Inputs/MethodPoolBSub.h @@ -1,3 +1,4 @@ @interface B (Sub) - (char *)method3; +- (char*)method4; @end diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 234bfcc2b0..499dcba279 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -116,6 +116,10 @@ module templates_right { module MethodPoolA { header "MethodPoolA.h" + explicit module Sub2 { + header "MethodPoolASub2.h" + } + explicit module Sub { header "MethodPoolASub.h" } diff --git a/test/Modules/method_pool.m b/test/Modules/method_pool.m index 1b94efb79f..712e55d4d6 100644 --- a/test/Modules/method_pool.m +++ b/test/Modules/method_pool.m @@ -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]; +} |