Files
TheRock/compiler/amd-llvm/clang/test/CIR/Transforms/eh-abi-lowering-construct-catch-invalid.cir
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

176 lines
5.5 KiB
Plaintext

// RUN: cir-opt %s -cir-eh-abi-lowering -split-input-file -verify-diagnostics
// Diagnostics emitted by the Itanium EHABI lowering for unsupported or
// malformed cir.construct_catch_param ops. Each case must terminate with a
// clean pass failure (not a crash).
!s32i = !cir.int<s, 32>
!u8i = !cir.int<u, 8>
!void = !cir.void
!rec_E = !cir.struct<"E" padded {!u8i}>
module attributes {cir.triple = "x86_64-unknown-linux-gnu"} {
cir.global "private" external @_ZTVN10__cxxabiv117__class_type_infoE
: !cir.ptr<!cir.ptr<!u8i>>
cir.global constant linkonce_odr @_ZTI1E
= #cir.typeinfo<{
#cir.global_view<@_ZTVN10__cxxabiv117__class_type_infoE, [2 : i32]>
: !cir.ptr<!u8i>}>
: !cir.struct<{!cir.ptr<!u8i>}>
cir.func private @_Z8mayThrowv()
cir.func private @_ZN1EC1ERKS_(!cir.ptr<!rec_E>, !cir.ptr<!rec_E>)
cir.func linkonce_odr hidden @__clang_cir_catch_copy__ZTS1E_ok(
%arg0: !cir.ptr<!rec_E>, %arg1: !cir.ptr<!rec_E>)
attributes {cir.eh.catch_copy_thunk} {
cir.call @_ZN1EC1ERKS_(%arg0, %arg1)
: (!cir.ptr<!rec_E>, !cir.ptr<!rec_E>) -> ()
cir.return
}
// Only non_trivial_copy is currently supported on Itanium.
cir.func @bad_kind() {
%0 = cir.alloca !rec_E, !cir.ptr<!rec_E>, ["e"] {alignment = 1 : i64}
cir.try_call @_Z8mayThrowv() ^bb1, ^bb2 : () -> ()
^bb1:
cir.br ^bb6
^bb2:
%1 = cir.eh.initiate : !cir.eh_token
cir.br ^bb3(%1 : !cir.eh_token)
^bb3(%eh_token: !cir.eh_token):
cir.eh.dispatch %eh_token : !cir.eh_token [
catch(#cir.global_view<@_ZTI1E> : !cir.ptr<!u8i>) : ^bb4,
unwind : ^bb5
]
^bb4(%eh_token.1: !cir.eh_token):
// expected-error @below {{ConstructCatchParam: only non_trivial_copy is supported}}
cir.construct_catch_param trivial_copy %eh_token.1 to %0
using @__clang_cir_catch_copy__ZTS1E_ok : !cir.ptr<!rec_E>
%ct, %exn = cir.begin_catch %eh_token.1
: !cir.eh_token -> (!cir.catch_token, !cir.ptr<!void>)
cir.end_catch %ct : !cir.catch_token
cir.br ^bb6
^bb5(%eh_token.2: !cir.eh_token):
cir.resume %eh_token.2 : !cir.eh_token
^bb6:
cir.return
}
}
// -----
!s32i = !cir.int<s, 32>
!u8i = !cir.int<u, 8>
!void = !cir.void
!rec_E = !cir.struct<"E" padded {!u8i}>
module attributes {cir.triple = "x86_64-unknown-linux-gnu"} {
cir.global "private" external @_ZTVN10__cxxabiv117__class_type_infoE
: !cir.ptr<!cir.ptr<!u8i>>
cir.global constant linkonce_odr @_ZTI1E
= #cir.typeinfo<{
#cir.global_view<@_ZTVN10__cxxabiv117__class_type_infoE, [2 : i32]>
: !cir.ptr<!u8i>}>
: !cir.struct<{!cir.ptr<!u8i>}>
cir.func private @_Z8mayThrowv()
// Thunk is properly tagged but is just a declaration (no body to inline).
cir.func private @__clang_cir_catch_copy__ZTS1E_decl(
!cir.ptr<!rec_E>, !cir.ptr<!rec_E>)
attributes {cir.eh.catch_copy_thunk}
cir.func @copy_fn_no_body() {
%0 = cir.alloca !rec_E, !cir.ptr<!rec_E>, ["e"] {alignment = 1 : i64}
cir.try_call @_Z8mayThrowv() ^bb1, ^bb2 : () -> ()
^bb1:
cir.br ^bb6
^bb2:
%1 = cir.eh.initiate : !cir.eh_token
cir.br ^bb3(%1 : !cir.eh_token)
^bb3(%eh_token: !cir.eh_token):
cir.eh.dispatch %eh_token : !cir.eh_token [
catch(#cir.global_view<@_ZTI1E> : !cir.ptr<!u8i>) : ^bb4,
unwind : ^bb5
]
^bb4(%eh_token.1: !cir.eh_token):
// expected-error @below {{catch-copy thunk has no body to inline}}
cir.construct_catch_param non_trivial_copy %eh_token.1 to %0
using @__clang_cir_catch_copy__ZTS1E_decl : !cir.ptr<!rec_E>
%ct, %exn = cir.begin_catch %eh_token.1
: !cir.eh_token -> (!cir.catch_token, !cir.ptr<!void>)
cir.end_catch %ct : !cir.catch_token
cir.br ^bb6
^bb5(%eh_token.2: !cir.eh_token):
cir.resume %eh_token.2 : !cir.eh_token
^bb6:
cir.return
}
}
// -----
!s32i = !cir.int<s, 32>
!u8i = !cir.int<u, 8>
!void = !cir.void
!rec_E = !cir.struct<"E" padded {!u8i}>
module attributes {cir.triple = "x86_64-unknown-linux-gnu"} {
cir.global "private" external @_ZTVN10__cxxabiv117__class_type_infoE
: !cir.ptr<!cir.ptr<!u8i>>
cir.global constant linkonce_odr @_ZTI1E
= #cir.typeinfo<{
#cir.global_view<@_ZTVN10__cxxabiv117__class_type_infoE, [2 : i32]>
: !cir.ptr<!u8i>}>
: !cir.struct<{!cir.ptr<!u8i>}>
cir.func private @_Z8mayThrowv()
cir.func private @_ZN1EC1ERKS_(!cir.ptr<!rec_E>, !cir.ptr<!rec_E>)
// Multi-block thunks (e.g. those produced for ExprWithCleanups initializers)
// are not yet supported by the Itanium lowering and must be diagnosed.
cir.func linkonce_odr hidden @__clang_cir_catch_copy__ZTS1E_multi(
%arg0: !cir.ptr<!rec_E>, %arg1: !cir.ptr<!rec_E>)
attributes {cir.eh.catch_copy_thunk} {
cir.br ^bb1
^bb1:
cir.call @_ZN1EC1ERKS_(%arg0, %arg1)
: (!cir.ptr<!rec_E>, !cir.ptr<!rec_E>) -> ()
cir.return
}
cir.func @multi_block_thunk() {
%0 = cir.alloca !rec_E, !cir.ptr<!rec_E>, ["e"] {alignment = 1 : i64}
cir.try_call @_Z8mayThrowv() ^bb1, ^bb2 : () -> ()
^bb1:
cir.br ^bb6
^bb2:
%1 = cir.eh.initiate : !cir.eh_token
cir.br ^bb3(%1 : !cir.eh_token)
^bb3(%eh_token: !cir.eh_token):
cir.eh.dispatch %eh_token : !cir.eh_token [
catch(#cir.global_view<@_ZTI1E> : !cir.ptr<!u8i>) : ^bb4,
unwind : ^bb5
]
^bb4(%eh_token.1: !cir.eh_token):
// expected-error @below {{multi-block catch-copy thunks are NYI}}
cir.construct_catch_param non_trivial_copy %eh_token.1 to %0
using @__clang_cir_catch_copy__ZTS1E_multi : !cir.ptr<!rec_E>
%ct, %exn = cir.begin_catch %eh_token.1
: !cir.eh_token -> (!cir.catch_token, !cir.ptr<!void>)
cir.end_catch %ct : !cir.catch_token
cir.br ^bb6
^bb5(%eh_token.2: !cir.eh_token):
cir.resume %eh_token.2 : !cir.eh_token
^bb6:
cir.return
}
}