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
130 lines
5.0 KiB
C++
130 lines
5.0 KiB
C++
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fexceptions -fcxx-exceptions -fclangir -emit-cir %s -o %t.cir
|
|
// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fexceptions -fcxx-exceptions -fclangir -emit-llvm %s -o %t-cir.ll
|
|
// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fexceptions -fcxx-exceptions -emit-llvm %s -o %t.ll
|
|
// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
|
|
|
|
class Base {
|
|
public:
|
|
Base(int);
|
|
~Base();
|
|
};
|
|
|
|
void mayThrow();
|
|
|
|
class Derived : public Base {
|
|
public:
|
|
Derived() : Base(0) { mayThrow(); }
|
|
};
|
|
|
|
void test_base_initializer() {
|
|
Derived d;
|
|
}
|
|
|
|
// CIR: cir.func {{.*}} @_ZN7DerivedC2Ev
|
|
// CIR: %[[THIS:.*]] = cir.load %{{.*}}
|
|
// CIR: %[[BASE_ADDR:.*]] = cir.base_class_addr %[[THIS]] : !cir.ptr<!rec_Derived> nonnull [0] -> !cir.ptr<!rec_Base>
|
|
// CIR: %[[ZERO:.*]] = cir.const #cir.int<0> : !s32i
|
|
// CIR: cir.call @_ZN4BaseC2Ei(%[[BASE_ADDR]], %[[ZERO]])
|
|
// CIR: cir.cleanup.scope {
|
|
// CIR: cir.call @_Z8mayThrowv() : () -> ()
|
|
// CIR: cir.yield
|
|
// CIR: } cleanup eh {
|
|
// CIR: cir.call @_ZN4BaseD2Ev(%[[BASE_ADDR]])
|
|
// CIR: cir.yield
|
|
// CIR: }
|
|
|
|
// LLVM: define {{.*}} void @_ZN7DerivedC2Ev
|
|
// LLVM: %[[THIS:.*]] = load ptr, ptr %{{.*}}
|
|
// LLVM: call void @_ZN4BaseC2Ei(ptr {{.*}} %[[THIS]], i32 {{.*}} 0)
|
|
// LLVM: invoke void @_Z8mayThrowv()
|
|
// LLVM: to label %[[INVOKE_CONT:.*]] unwind label %[[LPAD:.*]]
|
|
// LLVM: [[INVOKE_CONT:.*]]:
|
|
// LLVM: br label %[[EXIT:.*]]
|
|
// LLVM: [[LPAD:.*]]:
|
|
// LLVM: %[[EXN:.*]] = landingpad { ptr, i32 }
|
|
// LLVM: cleanup
|
|
// LLVM: br label %[[EH_CLEANUP:.*]]
|
|
// LLVM: [[EH_CLEANUP:.*]]:
|
|
// LLVM: call void @_ZN4BaseD2Ev(ptr {{.*}} %[[THIS]])
|
|
// LLVM: resume { ptr, i32 } %{{.*}}
|
|
// LLVM: [[EXIT:.*]]:
|
|
// LLVM: ret void
|
|
|
|
// OGCG emits @_ZN7DerivedC2Ev below @_ZN11VirtDerivedC1Ev
|
|
|
|
class VirtDerived : public virtual Base {
|
|
public:
|
|
VirtDerived() : Base(0) { mayThrow(); }
|
|
};
|
|
|
|
void test_virt_base_initializer() {
|
|
VirtDerived v;
|
|
}
|
|
|
|
// CIR: cir.func {{.*}} @_ZN11VirtDerivedC1Ev
|
|
// CIR: %[[THIS:.*]] = cir.load %{{.*}}
|
|
// CIR: %[[BASE_ADDR:.*]] = cir.base_class_addr %[[THIS]] : !cir.ptr<!rec_VirtDerived> nonnull [0] -> !cir.ptr<!rec_Base>
|
|
// CIR: %[[ZERO:.*]] = cir.const #cir.int<0> : !s32i
|
|
// CIR: cir.call @_ZN4BaseC2Ei(%[[BASE_ADDR]], %[[ZERO]])
|
|
// CIR: cir.cleanup.scope {
|
|
// CIR: %[[VTABLE_ADDR:.*]] = cir.vtable.address_point(@_ZTV11VirtDerived, address_point = <index = 0, offset = 3>) : !cir.vptr
|
|
// CIR: %[[VTABLE_PTR:.*]] = cir.vtable.get_vptr %[[THIS]] : !cir.ptr<!rec_VirtDerived> -> !cir.ptr<!cir.vptr>
|
|
// CIR: cir.store{{.*}} %[[VTABLE_ADDR]], %[[VTABLE_PTR]] : !cir.vptr, !cir.ptr<!cir.vptr>
|
|
// CIR: cir.call @_Z8mayThrowv() : () -> ()
|
|
// CIR: cir.yield
|
|
// CIR: } cleanup eh {
|
|
// CIR: cir.call @_ZN4BaseD2Ev(%[[BASE_ADDR]])
|
|
// CIR: cir.yield
|
|
// CIR: }
|
|
|
|
// LLVM: define {{.*}} void @_ZN11VirtDerivedC1Ev
|
|
// LLVM: %[[THIS:.*]] = load ptr, ptr %{{.*}}
|
|
// LLVM: call void @_ZN4BaseC2Ei(ptr {{.*}} %[[THIS]], i32 {{.*}} 0)
|
|
// LLVM: store ptr getelementptr inbounds nuw (i8, ptr @_ZTV11VirtDerived, i64 24), ptr %[[THIS]]
|
|
// LLVM: invoke void @_Z8mayThrowv()
|
|
// LLVM: to label %[[INVOKE_CONT:.*]] unwind label %[[LPAD:.*]]
|
|
// LLVM: [[INVOKE_CONT:.*]]:
|
|
// LLVM: br label %[[EXIT:.*]]
|
|
// LLVM: [[LPAD:.*]]:
|
|
// LLVM: %[[EXN:.*]] = landingpad { ptr, i32 }
|
|
// LLVM: cleanup
|
|
// LLVM: br label %[[EH_CLEANUP:.*]]
|
|
// LLVM: [[EH_CLEANUP:.*]]:
|
|
// LLVM: call void @_ZN4BaseD2Ev(ptr {{.*}} %[[THIS]])
|
|
// LLVM: resume { ptr, i32 } %{{.*}}
|
|
// LLVM: [[EXIT:.*]]:
|
|
// LLVM: ret void
|
|
|
|
// OGCG: define {{.*}} void @_ZN11VirtDerivedC1Ev
|
|
// OGCG: %[[THIS:.*]] = load ptr, ptr %{{.*}}
|
|
// OGCG: call void @_ZN4BaseC2Ei(ptr {{.*}} %[[THIS]], i32 {{.*}} 0)
|
|
// OGCG: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr] }, ptr @_ZTV11VirtDerived, i32 0, i32 0, i32 3), ptr %[[THIS]]
|
|
// OGCG: invoke void @_Z8mayThrowv()
|
|
// OGCG: to label %[[INVOKE_CONT:.*]] unwind label %[[LPAD:.*]]
|
|
// OGCG: [[INVOKE_CONT:.*]]:
|
|
// OGCG: ret void
|
|
// OGCG: [[LPAD:.*]]:
|
|
// OGCG: %[[EXN:.*]] = landingpad { ptr, i32 }
|
|
// OGCG: cleanup
|
|
// OGCG: call void @_ZN4BaseD2Ev(ptr {{.*}} %[[THIS]])
|
|
// OGCG: br label %[[EH_RESUME:.*]]
|
|
// OGCG: [[EH_RESUME:.*]]:
|
|
// OGCG: resume { ptr, i32 } %{{.*}}
|
|
|
|
// OGCG: define {{.*}} void @_ZN7DerivedC2Ev
|
|
// OGCG: %[[THIS:.*]] = load ptr, ptr %{{.*}}
|
|
// OGCG: call void @_ZN4BaseC2Ei(ptr {{.*}} %[[THIS]], i32 {{.*}} 0)
|
|
// OGCG: invoke void @_Z8mayThrowv()
|
|
// OGCG: to label %[[INVOKE_CONT:.*]] unwind label %[[LPAD:.*]]
|
|
// OGCG: [[INVOKE_CONT:.*]]:
|
|
// OGCG: ret void
|
|
// OGCG: [[LPAD:.*]]:
|
|
// OGCG: %[[EXN:.*]] = landingpad { ptr, i32 }
|
|
// OGCG: cleanup
|
|
// OGCG: call void @_ZN4BaseD2Ev(ptr {{.*}} %[[THIS]])
|
|
// OGCG: br label %[[EH_RESUME:.*]]
|
|
// OGCG: [[EH_RESUME:.*]]:
|
|
// OGCG: resume { ptr, i32 } %{{.*}}
|