Files
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

96 lines
3.0 KiB
C

// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu | FileCheck %s
// Verifying that we do, in fact, select the correct function in the following
// cases.
void foo(int m) __attribute__((overloadable, enable_if(m > 0, "")));
void foo(int m) __attribute__((overloadable));
// CHECK-LABEL: define{{.*}} void @test1
void test1(void) {
// CHECK: store ptr @_Z3fooi
void (*p)(int) = foo;
// CHECK: store ptr @_Z3fooi
void (*p2)(int) = &foo;
// CHECK: store ptr @_Z3fooi
p = foo;
// CHECK: store ptr @_Z3fooi
p = &foo;
// CHECK: store ptr @_Z3fooi
void *vp1 = (void*)&foo;
// CHECK: store ptr @_Z3fooi
void *vp2 = (void*)foo;
// CHECK: store ptr @_Z3fooi
vp1 = (void*)&foo;
// CHECK: store ptr @_Z3fooi
vp1 = (void*)foo;
}
void bar(int m) __attribute__((overloadable, enable_if(m > 0, "")));
void bar(int m) __attribute__((overloadable, enable_if(1, "")));
// CHECK-LABEL: define{{.*}} void @test2
void test2(void) {
// CHECK: store ptr @_Z3barUa9enable_ifILi1EEi
void (*p)(int) = bar;
// CHECK: store ptr @_Z3barUa9enable_ifILi1EEi
void (*p2)(int) = &bar;
// CHECK: store ptr @_Z3barUa9enable_ifILi1EEi
p = bar;
// CHECK: store ptr @_Z3barUa9enable_ifILi1EEi
p = &bar;
// CHECK: store ptr @_Z3barUa9enable_ifILi1EEi
void *vp1 = (void*)&bar;
// CHECK: store ptr @_Z3barUa9enable_ifILi1EEi
void *vp2 = (void*)bar;
// CHECK: store ptr @_Z3barUa9enable_ifILi1EEi
vp1 = (void*)&bar;
// CHECK: store ptr @_Z3barUa9enable_ifILi1EEi
vp1 = (void*)bar;
}
void baz(int m) __attribute__((overloadable, enable_if(1, "")));
void baz(int m) __attribute__((overloadable));
// CHECK-LABEL: define{{.*}} void @test3
void test3(void) {
// CHECK: store ptr @_Z3bazUa9enable_ifILi1EEi
void (*p)(int) = baz;
// CHECK: store ptr @_Z3bazUa9enable_ifILi1EEi
void (*p2)(int) = &baz;
// CHECK: store ptr @_Z3bazUa9enable_ifILi1EEi
p = baz;
// CHECK: store ptr @_Z3bazUa9enable_ifILi1EEi
p = &baz;
}
enum { TRUEFACTS = 1 };
void qux(int m) __attribute__((overloadable, enable_if(1, ""),
enable_if(TRUEFACTS, "")));
void qux(int m) __attribute__((overloadable, enable_if(1, "")));
// CHECK-LABEL: define{{.*}} void @test4
void test4(void) {
// CHECK: store ptr @_Z3quxUa9enable_ifILi1ELi1EEi
void (*p)(int) = qux;
// CHECK: store ptr @_Z3quxUa9enable_ifILi1ELi1EEi
void (*p2)(int) = &qux;
// CHECK: store ptr @_Z3quxUa9enable_ifILi1ELi1EEi
p = qux;
// CHECK: store ptr @_Z3quxUa9enable_ifILi1ELi1EEi
p = &qux;
}
// There was a bug where, when enable_if was present, overload resolution
// wouldn't pay attention to lower-priority attributes.
// (N.B. `foo` with pass_object_size should always be preferred)
// CHECK-LABEL: define{{.*}} void @test5
void test5(void) {
int foo(char *i) __attribute__((enable_if(1, ""), overloadable));
int foo(char *i __attribute__((pass_object_size(0))))
__attribute__((enable_if(1, ""), overloadable));
// CHECK: call i32 @_Z3fooUa9enable_ifILi1EEPcU17pass_object_size0
foo((void*)0);
}