1 // RUN: %clang_cc1 -fsyntax-only -Wselector -verify -Wno-objc-root-class %s 2 // rdar://8851684 3 4 @interface Foo 5 - (void) foo; 6 - (void) bar; 7 @end 8 9 @implementation Foo 10 - (void) bar 11 { 12 } 13 14 - (void) foo 15 { 16 SEL a,b,c; 17 a = @selector(b1ar); // expected-warning {{creating selector for nonexistent method 'b1ar'}} 18 b = @selector(bar); 19 } 20 @end 21 22 @interface I 23 - length; 24 @end 25 26 SEL func() 27 { 28 return @selector(length); // expected-warning {{creating selector for nonexistent method 'length'}} 29 } 30 31 // rdar://9545564 32 @class MSPauseManager; 33 34 @protocol MSPauseManagerDelegate 35 @optional 36 - (void)pauseManagerDidPause:(MSPauseManager *)manager; 37 - (int)respondsToSelector:(SEL)aSelector; 38 @end 39 40 @interface MSPauseManager 41 { 42 id<MSPauseManagerDelegate> _delegate; 43 } 44 @end 45 46 47 @implementation MSPauseManager 48 - (id) Meth { 49 if ([_delegate respondsToSelector:@selector(pauseManagerDidPause:)]) 50 return 0; 51 return 0; 52 } 53 @end 54 55 // rdar://12938616 56 @class NSXPCConnection; 57 58 @interface NSObject 59 @end 60 61 @interface INTF : NSObject 62 { 63 NSXPCConnection *cnx; // Comes in as a parameter. 64 } 65 - (void) Meth; 66 @end 67 68 extern SEL MySelector(SEL s); 69 70 @implementation INTF 71 - (void) Meth { 72 if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] ) // expected-warning {{creating selector for nonexistent method '_setQueue:'}} 73 { 74 } 75 76 if( [cnx respondsToSelector:@selector( _setQueueXX: )] ) // No warning here. 77 { 78 } 79 if( [cnx respondsToSelector:(@selector( _setQueueXX: ))] ) // No warning here. 80 { 81 } 82 } 83 @end 84 85 // rdar://14007194 86 @interface UxTechTest : NSObject 87 - (int) invalidate : (id)Arg; // expected-warning {{multiple selectors named 'invalidate:' found}} 88 + (int) C_invalidate : (int)arg; // expected-warning {{multiple selectors named 'C_invalidate:' found}} 89 @end 90 91 @interface UxTechTest(CAT) 92 - (char) invalidate : (int)arg; // expected-note {{also found}} 93 + (int) C_invalidate : (char)arg; // expected-note {{also found}} 94 @end 95 96 @interface NSPort : NSObject 97 - (double) invalidate : (void*)Arg1; // expected-note {{also found}} 98 + (int) C_invalidate : (id*)arg; // expected-note {{also found}} 99 @end 100 101 102 @interface USEText : NSPort 103 - (int) invalidate : (int)arg; // expected-note {{also found}} 104 @end 105 106 @implementation USEText 107 - (int) invalidate :(int) arg { return 0; } 108 @end 109 110 @interface USETextSub : USEText 111 - (int) invalidate : (id)arg; 112 @end 113