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
103 lines
3.6 KiB
Objective-C
103 lines
3.6 KiB
Objective-C
// RUN: %clang_cc1 %s -fblocks -fsyntax-only -verify
|
|
|
|
#define ASYNC(...) __attribute__((swift_async(__VA_ARGS__)))
|
|
#define ASYNC_ERROR(...) __attribute__((swift_async_error(__VA_ARGS__)))
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(zero_argument, 1)
|
|
void test_good(void (^handler)(int));
|
|
|
|
ASYNC(swift_private, 2)
|
|
ASYNC_ERROR(nonzero_argument, 2)
|
|
void test_good2(double, void (^handler)(double, int, double));
|
|
|
|
enum SomeEnum { SE_a, SE_b };
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonzero_argument, 1)
|
|
void test_good3(void (^handler)(enum SomeEnum, double));
|
|
|
|
ASYNC_ERROR(zero_argument, 1)
|
|
ASYNC(swift_private, 1)
|
|
void test_rev_order(void (^handler)(int));
|
|
|
|
@class NSError;
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonnull_error)
|
|
void test_nserror(void (^handler)(NSError *));
|
|
|
|
typedef struct __attribute__((objc_bridge(NSError))) __CFError * CFErrorRef;
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonnull_error)
|
|
void test_cferror(void (^handler)(CFErrorRef));
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonnull_error) // expected-error {{'swift_async_error' attribute with 'nonnull_error' convention can only be applied to a function with a completion handler with an error parameter}}
|
|
void test_interror(void (^handler)(int));
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(zero_argument, 1) // expected-error {{'swift_async_error' attribute with 'zero_argument' convention must have an integral-typed parameter in completion handler at index 1, type here is 'double'}}
|
|
void test_not_integral(void (^handler)(double));
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(none)
|
|
void test_none(void (^)(void));
|
|
|
|
ASYNC(none)
|
|
ASYNC_ERROR(none)
|
|
void test_double_none(void (^)(void));
|
|
|
|
ASYNC(none)
|
|
ASYNC_ERROR(none, 1) // expected-error {{'swift_async_error' attribute takes one argument}}
|
|
void test_double_none_args(void);
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonnull_error, 1) // expected-error{{'swift_async_error' attribute takes one argument}}
|
|
void test_args(void (^)(void));
|
|
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(zero_argument, 1, 1) // expected-error{{'swift_async_error' attribute takes no more than 2 arguments}}
|
|
void test_args2(void (^)(int));
|
|
|
|
ASYNC_ERROR(none) int x; // expected-warning{{'swift_async_error' attribute only applies to functions and Objective-C methods}}
|
|
|
|
@interface ObjC
|
|
-(void)m1:(void (^)(int))handler
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(zero_argument, 1);
|
|
|
|
-(void)m2:(int)first withSecond:(void (^)(int))handler
|
|
ASYNC(swift_private, 2)
|
|
ASYNC_ERROR(nonzero_argument, 1);
|
|
|
|
-(void)m3:(void (^)(void))block
|
|
ASYNC_ERROR(zero_argument, 1) // expected-error {{'swift_async_error' attribute parameter 2 is out of bounds}}
|
|
ASYNC(swift_private, 1);
|
|
|
|
-(void)m4:(void (^)(double, int, float))handler
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonzero_argument, 1); // expected-error{{swift_async_error' attribute with 'nonzero_argument' convention must have an integral-typed parameter in completion handler at index 1, type here is 'double'}}
|
|
|
|
-(void)m5:(void (^)(NSError *))handler
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonnull_error);
|
|
|
|
-(void)m6:(void (^)(void *))handler
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonnull_error); // expected-error{{'swift_async_error' attribute with 'nonnull_error' convention can only be applied to a method with a completion handler with an error parameter}}
|
|
@end
|
|
|
|
// 'swift_error' and 'swift_async_error' are OK on one function.
|
|
ASYNC(swift_private, 1)
|
|
ASYNC_ERROR(nonnull_error)
|
|
__attribute__((swift_error(nonnull_error)))
|
|
void swift_error_and_swift_async_error(void (^handler)(NSError *), NSError **);
|
|
|
|
@interface TestNoSwiftAsync
|
|
// swift_async_error can make sense without swift_async.
|
|
-(void)doAThingWithCompletion:(void (^)(NSError *))completion
|
|
ASYNC_ERROR(nonnull_error);
|
|
@end
|