mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 17:26:06 +00:00

When applied to out-parameters, the attributes specify the expected lifetime of the written-into object. Additionally, introduce OSReturnsRetainedOn(Non)Zero attributes, which specify that an ownership transfer happens depending on a return code. Differential Revision: https://reviews.llvm.org/D56292 llvm-svn: 350942
16 lines
710 B
Plaintext
16 lines
710 B
Plaintext
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
|
|
|
|
struct S {};
|
|
|
|
@interface I
|
|
@property (readonly) S* prop __attribute__((os_returns_retained));
|
|
- (S*) generateS __attribute__((os_returns_retained));
|
|
- (void) takeS:(S*) __attribute__((os_consumed)) s;
|
|
@end
|
|
|
|
typedef __attribute__((os_returns_retained)) id (^blockType)(); // expected-warning{{'os_returns_retained' attribute only applies to functions, Objective-C methods, Objective-C properties, and parameters}}
|
|
|
|
__auto_type b = ^ id (id filter) __attribute__((os_returns_retained)) { // expected-warning{{'os_returns_retained' attribute only applies to functions, Objective-C methods, Objective-C properties, and parameters}}
|
|
return filter;
|
|
};
|