CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
124 lines
4.8 KiB
Objective-C
124 lines
4.8 KiB
Objective-C
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-runtime=macosx-10.13.0 -fblocks -fobjc-arc -Wno-strict-prototypes %s -verify
|
|
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-runtime=macosx-10.13.0 -fblocks -fobjc-arc -xobjective-c++ %s -verify
|
|
|
|
#define EXT_RET __attribute__((objc_externally_retained))
|
|
|
|
@interface ObjCTy
|
|
@end
|
|
|
|
void test1(void) {
|
|
EXT_RET int a; // expected-warning{{'objc_externally_retained' can only be applied to}}
|
|
EXT_RET __weak ObjCTy *b; // expected-warning{{'objc_externally_retained' can only be applied to}}
|
|
EXT_RET __weak int (^c)(void); // expected-warning{{'objc_externally_retained' can only be applied to}}
|
|
|
|
EXT_RET int (^d)(void) = ^{return 0;};
|
|
EXT_RET ObjCTy *e = 0;
|
|
EXT_RET __strong ObjCTy *f = 0;
|
|
|
|
e = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
f = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
d = ^{ return 0; }; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
}
|
|
|
|
void test2(ObjCTy *a);
|
|
|
|
void test2(ObjCTy *a) EXT_RET {
|
|
a = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
}
|
|
|
|
EXT_RET ObjCTy *test3; // expected-warning{{'objc_externally_retained' can only be applied to}}
|
|
|
|
@interface X // expected-warning{{defined without specifying a base class}} expected-note{{add a super class}}
|
|
-(void)m: (ObjCTy *) p;
|
|
@end
|
|
@implementation X
|
|
-(void)m: (ObjCTy *) p EXT_RET {
|
|
p = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
}
|
|
@end
|
|
|
|
void test4(void) {
|
|
__attribute__((objc_externally_retained(0))) ObjCTy *a; // expected-error{{'objc_externally_retained' attribute takes no arguments}}
|
|
}
|
|
|
|
void test5(ObjCTy *first, __strong ObjCTy *second) EXT_RET {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0; // fine
|
|
}
|
|
|
|
void test6(ObjCTy *first,
|
|
__strong ObjCTy *second) EXT_RET {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0;
|
|
}
|
|
|
|
__attribute__((objc_root_class)) @interface Y @end
|
|
|
|
@implementation Y
|
|
- (void)test7:(__strong ObjCTy *)first
|
|
withThird:(ObjCTy *)second EXT_RET {
|
|
first = 0;
|
|
second = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
}
|
|
@end
|
|
|
|
void (^blk)(ObjCTy *, ObjCTy *) =
|
|
^(__strong ObjCTy *first, ObjCTy *second) EXT_RET {
|
|
first = 0;
|
|
second = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
};
|
|
|
|
void (^blk2)(ObjCTy *, ObjCTy *) =
|
|
^(__strong ObjCTy *first, ObjCTy *second) __attribute__((objc_externally_retained)) {
|
|
first = 0;
|
|
second = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
};
|
|
|
|
void test8(EXT_RET ObjCTy *x) {} // expected-warning{{'objc_externally_retained' attribute only applies to variables}}
|
|
|
|
#pragma clang attribute ext_ret.push(__attribute__((objc_externally_retained)), apply_to=any(function, block, objc_method))
|
|
void test9(ObjCTy *first, __strong ObjCTy *second) {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0;
|
|
}
|
|
void (^test10)(ObjCTy *first, ObjCTy *second) = ^(ObjCTy *first, __strong ObjCTy *second) {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0;
|
|
};
|
|
__attribute__((objc_root_class)) @interface Test11 @end
|
|
@implementation Test11
|
|
-(void)meth: (ObjCTy *)first withSecond:(__strong ObjCTy *)second {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0;
|
|
}
|
|
+(void)othermeth: (ObjCTy *)first withSecond:(__strong ObjCTy *)second {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0;
|
|
}
|
|
@end
|
|
|
|
#if __cplusplus
|
|
class Test12 {
|
|
void inline_member(ObjCTy *first, __strong ObjCTy *second) {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0;
|
|
}
|
|
static void static_inline_member(ObjCTy *first, __strong ObjCTy *second) {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0;
|
|
}
|
|
};
|
|
#endif
|
|
|
|
void test13(ObjCTy *first, __weak ObjCTy *second, __unsafe_unretained ObjCTy *third, __strong ObjCTy *fourth) {
|
|
first = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}}
|
|
second = 0;
|
|
third = 0;
|
|
fourth = 0;
|
|
}
|
|
|
|
#pragma clang attribute ext_ret.pop
|
|
|
|
__attribute__((objc_externally_retained))
|
|
void unprototyped();
|