Files
TheRock/compiler/amd-llvm/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/pointer-union.cpp
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

72 lines
1.8 KiB
C++

#include <cstdio>
#include "llvm/ADT/PointerUnion.h"
struct HasVirtual {
virtual void func() = 0;
virtual ~HasVirtual() = default;
};
struct DerivedWithVirtual : public HasVirtual {
virtual void func() override;
virtual ~DerivedWithVirtual() = default;
};
void DerivedWithVirtual::func() {}
struct alignas(8) Z {};
struct Derived : public Z {};
// Types for variable-width tag encoding test.
// 3 x alignof(4) + 2 x alignof(8) requires escape-coded tags because
// ceil(log2(5)) = 3 > min(NumLowBitsAvailable) = 2.
template <int I> struct alignas(4) Align4 {};
template <int I> struct alignas(8) Align8 {};
int main() {
int a = 5;
float f = 4.0;
Z z;
Derived derived;
DerivedWithVirtual dv;
llvm::PointerUnion<Z *, float *> z_float(&f);
llvm::PointerUnion<Z *, float *> raw_z_float(nullptr);
llvm::PointerUnion<Z *, float *> null_float(static_cast<float *>(nullptr));
llvm::PointerUnion<long long *, int *, float *> long_int_float(&a);
llvm::PointerUnion<Z *> z_only(&z);
llvm::PointerIntPair<llvm::PointerUnion<Z *, float *>, 1> union_int_pair(
z_float, 1);
puts("Break here");
z_float = &derived;
puts("Break here");
llvm::PointerUnion<HasVirtual *, float *> virtual_float(&dv);
puts("Break here");
// Function-local types stress template_argument lookup in debuggers.
struct alignas(8) Local {};
Local local;
llvm::PointerUnion<Local *, float *> local_float(&local);
puts("Break here");
// Variable-width tag encoding: formatter should fall back to void*.
Align4<0> a4_0;
Align8<0> a8_0;
llvm::PointerUnion<Align4<0> *, Align4<1> *, Align4<2> *, Align8<0> *,
Align8<1> *>
varwidth(&a4_0);
llvm::PointerUnion<Align4<0> *, Align4<1> *, Align4<2> *, Align8<0> *,
Align8<1> *>
varwidth_tier1(&a8_0);
puts("Break here");
}