Files
TheRock/compiler/amd-llvm/clang/test/CodeGenCXX/nullptr.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

80 lines
1.6 KiB
C++

// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -I%S -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -I%S -emit-llvm -o - %s -fexperimental-new-constant-interpreter | FileCheck %s
#include <typeinfo>
// CHECK: @_ZTIDn = external constant ptr
int* a = nullptr;
void f() {
int* a = nullptr;
}
typedef decltype(nullptr) nullptr_t;
nullptr_t get_nullptr();
struct X { };
void g() {
// CHECK: call ptr @_Z11get_nullptrv()
int (X::*pmf)(int) = get_nullptr();
}
const std::type_info& f2() {
return typeid(nullptr_t);
}
union U {
int n;
nullptr_t b;
};
// CHECK-LABEL: define {{.*}}pr23833_a
// CHECK: store
// CHECK: load
// CHECK-NOT: load
// CHECK: ret i1 false
bool pr23833_a(U &u) { return bool(u.b); }
// CHECK-LABEL: define {{.*}}pr23833_b
// CHECK: store
// CHECK: load
// CHECK-NOT: load
// CHECK: ret ptr null
nullptr_t pr23833_b(nullptr_t &n) { return n; }
struct X1 { operator int*(); };
struct X2 { operator const nullptr_t&(); };
// CHECK-LABEL: define {{.*}}pr23833_c
// CHECK: call {{.*}}X1
// CHECK: call {{.*}}X2
// CHECK-NOT: load
// CHECK: ret i32
int pr23833_c() {
return X1() != X2();
}
// CHECK-LABEL: define {{.*}}pr23833_d
// CHECK: call {{.*}}X2
// CHECK-NOT: load
// CHECK: store
// CHECK: load
// CHECK: ret ptr
int *pr23833_d() {
int *p = X2();
return p;
}
namespace PR39528 {
constexpr nullptr_t null = nullptr;
void f(nullptr_t);
void g() { f(null); }
}
// CHECK-LABEL: define {{.*}}pr137276
// CHECK: {{^}} store i64 0, ptr %arr, align 8{{$}}
void pr137276(nullptr_t np, int i) {
long arr[] = { long(np), i, 0 };
(void)arr;
}