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
84 lines
2.3 KiB
C++
84 lines
2.3 KiB
C++
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fsanitize=unreachable | FileCheck %s
|
|
|
|
void abort() __attribute__((noreturn));
|
|
|
|
// CHECK-LABEL: define{{.*}} void @_Z14calls_noreturnv()
|
|
void calls_noreturn() {
|
|
// Check absence (ptr) of call site attributes (including noreturn)
|
|
// CHECK: call void @_Z5abortv(){{[^#]*}}
|
|
abort();
|
|
|
|
// CHECK: __ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
|
|
struct A {
|
|
// CHECK: declare void @_Z5abortv() [[EXTERN_FN_ATTR:#[0-9]+]]
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A5call1Ev
|
|
void call1() {
|
|
// CHECK: call void @_ZN1A16does_not_return2Ev({{.*}}){{[^#]*}}
|
|
does_not_return2();
|
|
|
|
// CHECK: __ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
|
|
// Test static members. Checks are below after `struct A` scope ends.
|
|
static void does_not_return1() __attribute__((noreturn)) {
|
|
abort();
|
|
}
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A5call2Ev
|
|
void call2() {
|
|
// CHECK: call void @_ZN1A16does_not_return1Ev(){{[^#]*}}
|
|
does_not_return1();
|
|
|
|
// CHECK: __ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
|
|
// Test calls through pointers to non-static member functions.
|
|
typedef void (A::*MemFn)() __attribute__((noreturn));
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A5call3Ev
|
|
void call3() {
|
|
MemFn MF = &A::does_not_return2;
|
|
// CHECK: call void %{{[0-9]+\(.*}}){{[^#]*}}
|
|
(this->*MF)();
|
|
|
|
// CHECK: __ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
|
|
// Test regular members.
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A16does_not_return2Ev({{.*}})
|
|
// CHECK-SAME: [[USER_FN_ATTR:#[0-9]+]]
|
|
void does_not_return2() __attribute__((noreturn)) {
|
|
// CHECK: call void @_Z5abortv(){{[^#]*}}
|
|
abort();
|
|
|
|
// CHECK: call void @__ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
|
|
// CHECK: call void @__ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
};
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A16does_not_return1Ev()
|
|
// CHECK-SAME: [[USER_FN_ATTR]]
|
|
// CHECK: call void @_Z5abortv(){{[^#]*}}
|
|
|
|
void force_irgen() {
|
|
A a;
|
|
a.call1();
|
|
a.call2();
|
|
a.call3();
|
|
}
|
|
|
|
// `noreturn` should be removed from functions and call sites
|
|
// CHECK-LABEL: attributes
|
|
// CHECK-NOT: [[USER_FN_ATTR]] = { {{.*noreturn.*}} }
|
|
// CHECK-NOT: [[EXTERN_FN_ATTR]] = { {{.*noreturn.*}} }
|