mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-04 06:51:56 +00:00
[ObjC][Sema] Avoid ARC performSelector error for 'self' selector
The instance method 'self' does not actually return an over-retained object, so we shouldn't report an error when it's used with 'performSelector'. rdar://31071620 llvm-svn: 297961
This commit is contained in:
parent
8508e87998
commit
3e54835ad7
@ -3010,7 +3010,6 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||
case OMF_copy:
|
||||
case OMF_mutableCopy:
|
||||
case OMF_new:
|
||||
case OMF_self:
|
||||
case OMF_init:
|
||||
// Issue error, unless ns_returns_not_retained.
|
||||
if (!SelMethod->hasAttr<NSReturnsNotRetainedAttr>()) {
|
||||
|
@ -8,6 +8,7 @@
|
||||
- (id) init __attribute__((ns_returns_not_retained));
|
||||
- (id)PlusZero;
|
||||
- (id)PlusOne __attribute__((ns_returns_retained)); // expected-note {{method 'PlusOne' declared here}}
|
||||
- (id)self;
|
||||
@end
|
||||
|
||||
@interface I : NSObject
|
||||
@ -31,6 +32,8 @@
|
||||
|
||||
return [self performSelector : @selector(PlusZero)];
|
||||
return [self performSelector : @selector(PlusOne)]; // expected-error {{performSelector names a selector which retains the object}}
|
||||
|
||||
return [self performSelector: @selector(self)]; // No error, -self is not +1!
|
||||
}
|
||||
|
||||
- (id)performSelector:(SEL)aSelector { return 0; }
|
||||
|
Loading…
Reference in New Issue
Block a user