1 // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s
4 - (id)copy; // expected-note {{method 'copy' declared here}}
5 - (id) test __attribute__((ns_returns_retained)); // expected-note {{method 'test' declared here}}
6 + (id) new ; // expected-note {{method 'new' declared here}}
7 - (id) init __attribute__((ns_returns_not_retained));
9 - (id)PlusOne __attribute__((ns_returns_retained)); // expected-note {{method 'PlusOne' declared here}}
13 @interface I : NSObject
17 - (id)performSelector:(SEL)aSelector;
18 - (id)performSelector:(SEL)aSelector withObject:(id)object;
19 - (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
21 - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(double)delay inModes:(I *)modes;
27 return [self performSelector : @selector(copy)]; // expected-error {{performSelector names a selector which retains the object}}
28 return [self performSelector : @selector(test)]; // expected-error {{performSelector names a selector which retains the object}}
29 return [self performSelector : @selector(new)]; // expected-error {{performSelector names a selector which retains the object}}
30 return [self performSelector : @selector(init)];
31 return [self performSelector : sel1]; // expected-warning {{performSelector may cause a leak because its selector is unknown}} \
32 // expected-note {{used here}}
33 return [self performSelector: (@selector(PlusZero))];
35 return [self performSelector : @selector(PlusZero)];
36 return [self performSelector : @selector(PlusOne)]; // expected-error {{performSelector names a selector which retains the object}}
38 // Avoid the unknown selector warning for more complicated performSelector
39 // variations because it produces too many false positives.
40 [self performSelector: sel1 withObject:0 afterDelay:0 inModes:0];
42 return [self performSelector: @selector(self)]; // No error, -self is not +1!
45 - (id)performSelector:(SEL)aSelector { return 0; }
46 - (id)performSelector:(SEL)aSelector withObject:(id)object { return 0; }
47 - (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2 { return 0; }
48 - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(double)delay inModes:(I *)modes { }