2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2008-09-30 22:38:43 +08:00
|
|
|
|
|
|
|
typedef struct { int y; } Abstract;
|
|
|
|
|
|
|
|
typedef struct { int x; } Alternate;
|
|
|
|
|
|
|
|
#define INTERFERE_TYPE Alternate*
|
|
|
|
|
|
|
|
@protocol A
|
2008-11-24 07:26:13 +08:00
|
|
|
@property Abstract *x; // expected-note {{using}}
|
2008-09-30 22:38:43 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface B
|
2008-11-24 07:26:13 +08:00
|
|
|
@property Abstract *y; // expected-note {{using}}
|
2008-09-30 22:38:43 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface B (Category)
|
2008-11-24 07:26:13 +08:00
|
|
|
@property Abstract *z; // expected-note {{using}}
|
2008-09-30 22:38:43 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface InterferencePre
|
2008-11-24 07:26:13 +08:00
|
|
|
-(void) x; // expected-note {{also found}}
|
|
|
|
-(void) y; // expected-note {{also found}}
|
|
|
|
-(void) z; // expected-note {{also found}}
|
2008-10-21 18:37:50 +08:00
|
|
|
-(void) setX: (INTERFERE_TYPE) arg;
|
|
|
|
-(void) setY: (INTERFERE_TYPE) arg;
|
|
|
|
-(void) setZ: (INTERFERE_TYPE) arg;
|
2008-09-30 22:38:43 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
void f0(id a0) {
|
|
|
|
Abstract *l = [a0 x]; // expected-warning {{multiple methods named 'x' found}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void f1(id a0) {
|
|
|
|
Abstract *l = [a0 y]; // expected-warning {{multiple methods named 'y' found}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void f2(id a0) {
|
|
|
|
Abstract *l = [a0 z]; // expected-warning {{multiple methods named 'z' found}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void f3(id a0, Abstract *a1) {
|
2008-10-21 18:37:50 +08:00
|
|
|
[ a0 setX: a1];
|
2008-09-30 22:38:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void f4(id a0, Abstract *a1) {
|
2008-10-21 18:37:50 +08:00
|
|
|
[ a0 setY: a1];
|
2008-09-30 22:38:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void f5(id a0, Abstract *a1) {
|
2008-10-21 18:37:50 +08:00
|
|
|
[ a0 setZ: a1];
|
2008-09-30 22:38:43 +08:00
|
|
|
}
|
2010-08-11 02:10:50 +08:00
|
|
|
|
|
|
|
// pr7861
|
|
|
|
void f6(id<A> a0) {
|
|
|
|
Abstract *l = [a0 x];
|
|
|
|
}
|
2011-06-16 09:15:19 +08:00
|
|
|
|
|
|
|
struct test3a { int x, y; };
|
|
|
|
struct test3b { unsigned x, y; };
|
|
|
|
@interface Test3A - (struct test3a) test3; @end
|
|
|
|
@interface Test3B - (struct test3b) test3; @end
|
|
|
|
void test3(id x) {
|
|
|
|
(void) [x test3];
|
|
|
|
}
|
|
|
|
|
|
|
|
struct test4a { int x, y; };
|
|
|
|
struct test4b { float x, y; };
|
|
|
|
@interface Test4A - (struct test4a) test4; @end //expected-note{{using}}
|
|
|
|
@interface Test4B - (struct test4b) test4; @end //expected-note{{also found}}
|
|
|
|
void test4(id x) {
|
|
|
|
(void) [x test4]; //expected-warning {{multiple methods named 'test4' found}}
|
|
|
|
}
|
2014-12-19 03:41:11 +08:00
|
|
|
|
|
|
|
// rdar://19265296
|
|
|
|
#pragma clang diagnostic ignored "-Wobjc-multiple-method-names"
|
|
|
|
@interface NSObject
|
|
|
|
+ (id)alloc;
|
|
|
|
+ (id)class;
|
|
|
|
- (id) init;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@class NSString;
|
|
|
|
@interface A : NSObject
|
|
|
|
- (instancetype)initWithType:(NSString *)whatever;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface Test : NSObject @end
|
|
|
|
|
|
|
|
@implementation Test
|
|
|
|
+ (instancetype)foo
|
|
|
|
{
|
|
|
|
return [[[self class] alloc] initWithType:3];
|
|
|
|
}
|
|
|
|
- (instancetype)initWithType:(int)whatever
|
|
|
|
{
|
|
|
|
return [super init];
|
|
|
|
}
|
|
|
|
@end
|