Files
TheRock/compiler/amd-llvm/clang/test/CodeGenCXX/cxx1z-initializer-aggregate.cpp
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

133 lines
4.7 KiB
C++

// RUN: %clang_cc1 -std=c++1z %s -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -emit-llvm -o - | FileCheck %s
namespace Constant {
struct A {
int n;
char k;
~A();
};
struct B {
char k2;
};
struct C : B {};
struct D : A, C {};
C c1 = {};
C c2 = {1};
// CHECK: @_ZN8Constant2c1E ={{.*}} global { i8 } zeroinitializer, align 1
// CHECK: @_ZN8Constant2c2E ={{.*}} global { i8 } { i8 1 }, align 1
// Test packing bases into tail padding.
D d1 = {};
D d2 = {1, 2, 3};
D d3 = {1};
// CHECK: @_ZN8Constant2d1E ={{.*}} global { i32, i8, i8 } zeroinitializer, align 4
// CHECK: @_ZN8Constant2d2E ={{.*}} global { i32, i8, i8 } { i32 1, i8 2, i8 3 }, align 4
// CHECK: @_ZN8Constant2d3E ={{.*}} global { i32, i8, i8 } { i32 1, i8 0, i8 0 }, align 4
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN8Constant1DD1Ev, {{.*}} @_ZN8Constant2d1E
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN8Constant1DD1Ev, {{.*}} @_ZN8Constant2d2E
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN8Constant1DD1Ev, {{.*}} @_ZN8Constant2d3E
}
namespace Dynamic {
struct A {
A();
A(int);
A(const char*, unsigned);
~A();
void *p;
};
struct B {
~B();
int n = 5;
};
struct C {
C(bool = true);
};
int f(), g(), h(), i();
struct D : A, B, C {
int n = f();
};
D d1 = {};
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK: call void @_ZN7Dynamic1AC2Ev({{.*}} @_ZN7Dynamic2d1E
// CHECK: store i32 5, {{.*}}ptr getelementptr inbounds {{.*}} @_ZN7Dynamic2d1E{{.*}}, i64 8
// CHECK: invoke void @_ZN7Dynamic1CC2Eb({{.*}} @_ZN7Dynamic2d1E{{.*}}, i1 noundef zeroext true)
// CHECK: unwind label %[[UNWIND:.*]]
// CHECK: invoke noundef i32 @_ZN7Dynamic1fEv()
// CHECK: unwind label %[[UNWIND:.*]]
// CHECK: store i32 {{.*}}, ptr getelementptr inbounds nuw (i8, ptr @_ZN7Dynamic2d1E, i64 12)
// CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN7Dynamic1DD1Ev, {{.*}} @_ZN7Dynamic2d1E
// CHECK: ret
//
// UNWIND:
// CHECK: call void @_ZN7Dynamic1BD1Ev(ptr {{.*}}getelementptr inbounds {{.*}} @_ZN7Dynamic2d1E{{.*}}, i64 8
// CHECK: call void @_ZN7Dynamic1AD1Ev({{.*}} @_ZN7Dynamic2d1E
D d2 = {1, 2, false};
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK: call void @_ZN7Dynamic1AC1Ei({{.*}} @_ZN7Dynamic2d2E{{.*}}, i32 noundef 1)
// CHECK: store i32 2, {{.*}}ptr getelementptr inbounds {{.*}}@_ZN7Dynamic2d2E{{.*}}, i64 8
// CHECK: invoke void @_ZN7Dynamic1CC1Eb({{.*}} @_ZN7Dynamic2d2E{{.*}}, i1 noundef zeroext false)
// CHECK: invoke noundef i32 @_ZN7Dynamic1fEv()
// CHECK: store i32 {{.*}}, ptr getelementptr inbounds nuw (i8, ptr @_ZN7Dynamic2d2E, i64 12)
// CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN7Dynamic1DD1Ev, {{.*}} @_ZN7Dynamic2d2E
// CHECK: ret void
D d3 = {g(), h(), {}, i()};
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK: %[[G_CALL:.*]] = call noundef i32 @_ZN7Dynamic1gEv()
// CHECK: call void @_ZN7Dynamic1AC1Ei({{.*}} @_ZN7Dynamic2d3E{{.*}}, i32 noundef %[[G_CALL]])
// CHECK: %[[H_CALL:.*]] = invoke noundef i32 @_ZN7Dynamic1hEv()
// CHECK: unwind label %[[DESTROY_A_LPAD:.*]]
// CHECK: store i32 %[[H_CALL]], {{.*}}ptr getelementptr inbounds {{.*}} @_ZN7Dynamic2d3E{{.*}}, i64 8
// CHECK: invoke void @_ZN7Dynamic1CC2Eb({{.*}} @_ZN7Dynamic2d3E{{.*}}, i1 noundef zeroext true)
// CHECK: unwind label %[[DESTROY_AB_LPAD:.*]]
// CHECK: %[[I_CALL:.*]] = invoke noundef i32 @_ZN7Dynamic1iEv()
// CHECK: unwind label %[[DESTROY_AB_LPAD:.*]]
// CHECK: store i32 %[[I_CALL]], ptr getelementptr inbounds nuw (i8, ptr @_ZN7Dynamic2d3E, i64 12)
// CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN7Dynamic1DD1Ev, {{.*}} @_ZN7Dynamic2d3E
// CHECK: ret
//
// DESTROY_A_LPAD:
// CHECK: br label %[[A_CLEANUP:.*]]
//
// DESTROY_B_LPAD:
// CHECK: call void @_ZN7Dynamic1BD1Ev(ptr {{.*}}getelementptr inbounds {{.*}} @_ZN7Dynamic2d3E{{.*}}, i64 8
// CHECK: br label %[[A_CLEANUP:.*]]
//
// A_CLEANUP:
// CHECK: call void @_ZN7Dynamic1AD1Ev({{.*}} @_ZN7Dynamic2d3E
}
namespace Instantiated1 {
struct A { A(); };
struct B : A { using A::A; };
template<int> B v({});
template B v<0>;
// CHECK-LABEL: define {{.*}}global_var_init{{.*}} comdat($_ZN13Instantiated11vILi0EEE) {
// CHECK: call void @_ZN13Instantiated11BC1Ev(ptr {{[^,]*}} @_ZN13Instantiated11vILi0EEE)
}
namespace Instantiated2 {
struct A { A(); };
struct B : A {};
template<int> B v({});
template B v<0>;
// CHECK-LABEL: define {{.*}}global_var_init{{.*}} comdat($_ZN13Instantiated21vILi0EEE) {
// CHECK: call void @_ZN13Instantiated21AC2Ev(
}