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
120 lines
2.2 KiB
C++
120 lines
2.2 KiB
C++
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -Wno-unreachable-code -Werror -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
|
|
|
|
int val = 42;
|
|
int& test1() {
|
|
return throw val, val;
|
|
}
|
|
|
|
int test2() {
|
|
return val ? throw val : val;
|
|
}
|
|
|
|
void test3() {
|
|
throw false;
|
|
}
|
|
|
|
// PR10582
|
|
int test4() {
|
|
return 1 ? throw val : val;
|
|
}
|
|
|
|
// PR15923
|
|
int test5(bool x, bool y, int z) {
|
|
return (x ? throw 1 : y) ? z : throw 2;
|
|
}
|
|
// CHECK-LABEL: define{{.*}} i32 @_Z5test5bbi(
|
|
// CHECK: br i1
|
|
//
|
|
// x.true:
|
|
// CHECK: call void @__cxa_throw(
|
|
// CHECK-NEXT: unreachable
|
|
//
|
|
// x.false:
|
|
// CHECK: br i1
|
|
//
|
|
// y.true:
|
|
// CHECK: load i32, ptr
|
|
// CHECK: br label
|
|
//
|
|
// y.false:
|
|
// CHECK: call void @__cxa_throw(
|
|
// CHECK-NEXT: unreachable
|
|
//
|
|
// end:
|
|
// CHECK: ret i32
|
|
|
|
int test6(bool x, bool y, int z) {
|
|
return (x ? throw 1 : y) ? z : (throw 2);
|
|
}
|
|
// CHECK-LABEL: define{{.*}} i32 @_Z5test6bbi(
|
|
// CHECK: br i1
|
|
//
|
|
// x.true:
|
|
// CHECK: call void @__cxa_throw(
|
|
// CHECK-NEXT: unreachable
|
|
//
|
|
// x.false:
|
|
// CHECK: br i1
|
|
//
|
|
// y.true:
|
|
// CHECK: load i32, ptr
|
|
// CHECK: br label
|
|
//
|
|
// y.false:
|
|
// CHECK: call void @__cxa_throw(
|
|
// CHECK-NEXT: unreachable
|
|
//
|
|
// end:
|
|
// CHECK: ret i32
|
|
|
|
namespace DR1560 {
|
|
struct A {
|
|
~A();
|
|
};
|
|
extern bool b;
|
|
A get();
|
|
// CHECK-LABEL: @_ZN6DR15601bE
|
|
const A &r = b ? get() : throw 0;
|
|
// CHECK-NOT: call {{.*}}@_ZN6DR15601AD1Ev
|
|
// CHECK: call {{.*}} @__cxa_atexit(ptr @_ZN6DR15601AD1Ev, ptr @_ZGRN6DR15601rE
|
|
// CHECK-NOT: call {{.*}}@_ZN6DR15601AD1Ev
|
|
|
|
// PR28184
|
|
void conditional_throw() {
|
|
int a;
|
|
(true ? throw 0 : a) = 0; // CHECK: call void @__cxa_throw({{.*}})
|
|
}
|
|
}
|
|
|
|
// CHECK-LABEL: define{{.*}} void @_Z5test7b(
|
|
void test7(bool cond) {
|
|
// CHECK: br i1
|
|
//
|
|
// x.true:
|
|
// CHECK: call void @__cxa_throw(
|
|
// CHECK-NEXT: unreachable
|
|
//
|
|
// x.false:
|
|
// CHECK: br label
|
|
//
|
|
// end:
|
|
// CHECK: ret void
|
|
cond ? throw test7 : val;
|
|
}
|
|
|
|
// CHECK-LABEL: define{{.*}} nonnull align 4 dereferenceable(4) ptr @_Z5test8b(
|
|
int &test8(bool cond) {
|
|
// CHECK: br i1
|
|
//
|
|
// x.true:
|
|
// CHECK: br label
|
|
//
|
|
// x.false:
|
|
// CHECK: call void @__cxa_throw(
|
|
// CHECK-NEXT: unreachable
|
|
//
|
|
// end:
|
|
// CHECK: ret ptr @val
|
|
return cond ? val : ((throw "foo"));
|
|
}
|