1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -Wselector -verify -Wno-objc-root-class %s 2f4a2713aSLionel Sambuc// rdar://8851684 3f4a2713aSLionel Sambuc 4f4a2713aSLionel Sambuc@interface Foo 5f4a2713aSLionel Sambuc- (void) foo; 6f4a2713aSLionel Sambuc- (void) bar; 7f4a2713aSLionel Sambuc@end 8f4a2713aSLionel Sambuc 9f4a2713aSLionel Sambuc@implementation Foo 10f4a2713aSLionel Sambuc- (void) bar 11f4a2713aSLionel Sambuc{ 12f4a2713aSLionel Sambuc} 13f4a2713aSLionel Sambuc 14f4a2713aSLionel Sambuc- (void) foo 15f4a2713aSLionel Sambuc{ 16f4a2713aSLionel Sambuc SEL a,b,c; 17*0a6a1f1dSLionel Sambuc a = @selector(b1ar); 18f4a2713aSLionel Sambuc b = @selector(bar); 19f4a2713aSLionel Sambuc} 20f4a2713aSLionel Sambuc@end 21f4a2713aSLionel Sambuc 22f4a2713aSLionel Sambuc@interface I 23f4a2713aSLionel Sambuc- length; 24f4a2713aSLionel Sambuc@end 25f4a2713aSLionel Sambuc 26f4a2713aSLionel SambucSEL func() 27f4a2713aSLionel Sambuc{ 28*0a6a1f1dSLionel Sambuc return @selector(length); // expected-warning {{no method with selector 'length' is implemented in this translation unit}} 29f4a2713aSLionel Sambuc} 30f4a2713aSLionel Sambuc 31f4a2713aSLionel Sambuc// rdar://9545564 32f4a2713aSLionel Sambuc@class MSPauseManager; 33f4a2713aSLionel Sambuc 34f4a2713aSLionel Sambuc@protocol MSPauseManagerDelegate 35f4a2713aSLionel Sambuc@optional 36f4a2713aSLionel Sambuc- (void)pauseManagerDidPause:(MSPauseManager *)manager; 37f4a2713aSLionel Sambuc- (int)respondsToSelector:(SEL)aSelector; 38f4a2713aSLionel Sambuc@end 39f4a2713aSLionel Sambuc 40f4a2713aSLionel Sambuc@interface MSPauseManager 41f4a2713aSLionel Sambuc{ 42f4a2713aSLionel Sambuc id<MSPauseManagerDelegate> _delegate; 43f4a2713aSLionel Sambuc} 44f4a2713aSLionel Sambuc@end 45f4a2713aSLionel Sambuc 46f4a2713aSLionel Sambuc 47f4a2713aSLionel Sambuc@implementation MSPauseManager 48f4a2713aSLionel Sambuc- (id) Meth { 49f4a2713aSLionel Sambuc if ([_delegate respondsToSelector:@selector(pauseManagerDidPause:)]) 50f4a2713aSLionel Sambuc return 0; 51f4a2713aSLionel Sambuc return 0; 52f4a2713aSLionel Sambuc} 53f4a2713aSLionel Sambuc@end 54f4a2713aSLionel Sambuc 55f4a2713aSLionel Sambuc// rdar://12938616 56f4a2713aSLionel Sambuc@class NSXPCConnection; 57f4a2713aSLionel Sambuc 58f4a2713aSLionel Sambuc@interface NSObject 59f4a2713aSLionel Sambuc@end 60f4a2713aSLionel Sambuc 61f4a2713aSLionel Sambuc@interface INTF : NSObject 62f4a2713aSLionel Sambuc{ 63f4a2713aSLionel Sambuc NSXPCConnection *cnx; // Comes in as a parameter. 64f4a2713aSLionel Sambuc} 65f4a2713aSLionel Sambuc- (void) Meth; 66f4a2713aSLionel Sambuc@end 67f4a2713aSLionel Sambuc 68f4a2713aSLionel Sambucextern SEL MySelector(SEL s); 69f4a2713aSLionel Sambuc 70f4a2713aSLionel Sambuc@implementation INTF 71f4a2713aSLionel Sambuc- (void) Meth { 72*0a6a1f1dSLionel Sambuc if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] ) 73f4a2713aSLionel Sambuc { 74f4a2713aSLionel Sambuc } 75f4a2713aSLionel Sambuc 76f4a2713aSLionel Sambuc if( [cnx respondsToSelector:@selector( _setQueueXX: )] ) // No warning here. 77f4a2713aSLionel Sambuc { 78f4a2713aSLionel Sambuc } 79f4a2713aSLionel Sambuc if( [cnx respondsToSelector:(@selector( _setQueueXX: ))] ) // No warning here. 80f4a2713aSLionel Sambuc { 81f4a2713aSLionel Sambuc } 82f4a2713aSLionel Sambuc} 83f4a2713aSLionel Sambuc@end 84f4a2713aSLionel Sambuc 85f4a2713aSLionel Sambuc// rdar://14007194 86f4a2713aSLionel Sambuc@interface UxTechTest : NSObject 87*0a6a1f1dSLionel Sambuc- (int) invalidate : (id)Arg; 88*0a6a1f1dSLionel Sambuc+ (int) C_invalidate : (int)arg; 89f4a2713aSLionel Sambuc@end 90f4a2713aSLionel Sambuc 91f4a2713aSLionel Sambuc@interface UxTechTest(CAT) 92*0a6a1f1dSLionel Sambuc- (char) invalidate : (int)arg; 93*0a6a1f1dSLionel Sambuc+ (int) C_invalidate : (char)arg; 94f4a2713aSLionel Sambuc@end 95f4a2713aSLionel Sambuc 96f4a2713aSLionel Sambuc@interface NSPort : NSObject 97*0a6a1f1dSLionel Sambuc- (double) invalidate : (void*)Arg1; 98*0a6a1f1dSLionel Sambuc+ (int) C_invalidate : (id*)arg; 99f4a2713aSLionel Sambuc@end 100f4a2713aSLionel Sambuc 101f4a2713aSLionel Sambuc 102f4a2713aSLionel Sambuc@interface USEText : NSPort 103*0a6a1f1dSLionel Sambuc- (int) invalidate : (int)arg; 104f4a2713aSLionel Sambuc@end 105f4a2713aSLionel Sambuc 106f4a2713aSLionel Sambuc@implementation USEText 107f4a2713aSLionel Sambuc- (int) invalidate :(int) arg { return 0; } 108f4a2713aSLionel Sambuc@end 109f4a2713aSLionel Sambuc 110f4a2713aSLionel Sambuc@interface USETextSub : USEText 111f4a2713aSLionel Sambuc- (int) invalidate : (id)arg; 112f4a2713aSLionel Sambuc@end 113*0a6a1f1dSLionel Sambuc 114*0a6a1f1dSLionel Sambuc// rdar://16428638 115*0a6a1f1dSLionel Sambuc@interface I16428638 116*0a6a1f1dSLionel Sambuc- (int) compare: (I16428638 *) arg1; // commenting out this line avoids the warning 117*0a6a1f1dSLionel Sambuc@end 118*0a6a1f1dSLionel Sambuc 119*0a6a1f1dSLionel Sambuc@interface J16428638 120*0a6a1f1dSLionel Sambuc- (int) compare: (J16428638 *) arg1; 121*0a6a1f1dSLionel Sambuc@end 122*0a6a1f1dSLionel Sambuc 123*0a6a1f1dSLionel Sambuc@implementation J16428638 124*0a6a1f1dSLionel Sambuc- (void)method { 125*0a6a1f1dSLionel Sambuc SEL s = @selector(compare:); // spurious warning 126*0a6a1f1dSLionel Sambuc (void)s; 127*0a6a1f1dSLionel Sambuc} 128*0a6a1f1dSLionel Sambuc- (int) compare: (J16428638 *) arg1 { 129*0a6a1f1dSLionel Sambuc return 0; 130*0a6a1f1dSLionel Sambuc} 131*0a6a1f1dSLionel Sambuc@end 132*0a6a1f1dSLionel Sambuc 133*0a6a1f1dSLionel Sambucvoid test16428638() { 134*0a6a1f1dSLionel Sambuc SEL s = @selector(compare:); 135*0a6a1f1dSLionel Sambuc (void)s; 136*0a6a1f1dSLionel Sambuc} 137