blob: c015eb871150caf6baa5074f65c00cbba7b10db3 [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s
Fariborz Jahanian9670e172011-07-05 22:38:59 +00002// rdar://9659270
3
4@interface NSObject
5- (id)copy; // expected-note {{method declared here}}
6- (id) test __attribute__((ns_returns_retained)); // expected-note {{method declared here}}
7+ (id) new ; // expected-note {{method declared here}}
8- (id) init __attribute__((ns_returns_not_retained));
9- (id)PlusZero;
10- (id)PlusOne __attribute__((ns_returns_retained)); // expected-note {{method declared here}}
11@end
12
13@interface I : NSObject
14{
15 SEL sel1;
16}
17- (id)performSelector:(SEL)aSelector;
18- (id)performSelector:(SEL)aSelector withObject:(id)object;
19- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
20@end
21
22@implementation I
23- (id) Meth {
24 return [self performSelector : @selector(copy)]; // expected-error {{performSelector names a selector which retains the object}}
25 return [self performSelector : @selector(test)]; // expected-error {{performSelector names a selector which retains the object}}
26 return [self performSelector : @selector(new)]; // expected-error {{performSelector names a selector which retains the object}}
27 return [self performSelector : @selector(init)];
28 return [self performSelector : sel1]; // expected-warning {{performSelector may cause a leak because its selector is unknown}} \
29 // expected-note {{used here}}
30
31 return [self performSelector : @selector(PlusZero)];
32 return [self performSelector : @selector(PlusOne)]; // expected-error {{performSelector names a selector which retains the object}}
33}
34
35- (id)performSelector:(SEL)aSelector { return 0; }
36- (id)performSelector:(SEL)aSelector withObject:(id)object { return 0; }
37- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2 { return 0; }
38@end