Retain all hidden methods in the global method pool, because they may become visible <rdar://problem/13172858>.

llvm-svn: 174648
This commit is contained in:
Douglas Gregor 2013-02-07 19:13:24 +00:00
parent 0b62f8a632
commit 560b7fa0c4
5 changed files with 18 additions and 0 deletions

View 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>() ||

View File

@ -1,3 +1,4 @@
@interface A (Sub)
- (char)method3;
- (char*)method4;
@end

View File

@ -1,3 +1,4 @@
@interface B (Sub)
- (char *)method3;
- (char*)method4;
@end

View 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"
}

View 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];
}