Files
TheRock/compiler/amd-llvm/clang/test/SemaObjC/strong-in-c-struct.m
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

75 lines
2.3 KiB
Objective-C

// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -fsyntax-only -verify %s
typedef struct {
id a;
} Strong;
void callee_variadic(const char *, ...);
void test_variadic(void) {
Strong t;
callee_variadic("s", t); // expected-error {{cannot pass non-trivial C object of type 'Strong' by value to variadic function}}
}
void test_jump0(int cond) {
switch (cond) {
case 0:
;
Strong x; // expected-note {{jump bypasses initialization of variable of non-trivial C struct type}}
break;
case 1: // expected-error {{cannot jump from switch statement to this case label}}
x.a = 0;
break;
}
}
void test_jump1(void) {
static void *ips[] = { &&L0 };
L0: // expected-note {{possible target of indirect goto}}
;
Strong x; // expected-note {{jump exits scope of variable with non-trivial destructor}}
goto *ips; // expected-error {{cannot jump}}
}
typedef void (^BlockTy)(void);
void func(BlockTy);
void func2(Strong);
void test_block_scope0(int cond) {
Strong x; // expected-note {{jump enters lifetime of block which captures a C struct that is non-trivial to destroy}}
switch (cond) {
case 0:
func(^{ func2(x); });
break;
default: // expected-error {{cannot jump from switch statement to this case label}}
break;
}
}
void test_block_scope1(void) {
static void *ips[] = { &&L0 };
L0: // expected-note {{possible target of indirect goto}}
;
Strong x; // expected-note {{jump exits scope of variable with non-trivial destructor}} expected-note {{jump exits lifetime of block which captures a C struct that is non-trivial to destroy}}
func(^{ func2(x); });
goto *ips; // expected-error {{cannot jump}}
}
void test_compound_literal0(int cond, id x) {
switch (cond) {
case 0:
(void)(Strong){ .a = x }; // expected-note {{jump enters lifetime of a compound literal that is non-trivial to destruct}}
break;
default: // expected-error {{cannot jump from switch statement to this case label}}
break;
}
}
void test_compound_literal1(id x) {
static void *ips[] = { &&L0 };
L0: // expected-note {{possible target of indirect goto}}
;
(void)(Strong){ .a = x }; // expected-note {{jump exits lifetime of a compound literal that is non-trivial to destruct}}
goto *ips; // expected-error {{cannot jump}}
}