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
97 lines
3.4 KiB
C++
97 lines
3.4 KiB
C++
// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -fblocks -o - %s | FileCheck %s
|
|
|
|
struct S {
|
|
int a[4];
|
|
S(int *, int * __attribute__((noescape)));
|
|
S &operator=(int * __attribute__((noescape)));
|
|
void m0(int *, int * __attribute__((noescape)));
|
|
virtual void vm1(int *, int * __attribute__((noescape)));
|
|
};
|
|
|
|
// CHECK: define{{.*}} void @_ZN1SC2EPiS0_(ptr {{.*}}, {{.*}}, {{.*}} noundef captures(address) {{%.*}})
|
|
// CHECK: define{{.*}} void @_ZN1SC1EPiS0_(ptr {{.*}}, {{.*}}, {{.*}} noundef captures(address) {{%.*}}) {{.*}} {
|
|
// CHECK: call void @_ZN1SC2EPiS0_(ptr {{.*}}, {{.*}}, {{.*}} captures(address) {{.*}})
|
|
|
|
S::S(int *, int * __attribute__((noescape))) {}
|
|
|
|
// CHECK: define {{.*}} ptr @_ZN1SaSEPi(ptr {{.*}}, {{.*}} noundef captures(address) {{%.*}})
|
|
S &S::operator=(int * __attribute__((noescape))) { return *this; }
|
|
|
|
// CHECK: define{{.*}} void @_ZN1S2m0EPiS0_(ptr {{.*}}, {{.*}} noundef captures(address) {{%.*}})
|
|
void S::m0(int *, int * __attribute__((noescape))) {}
|
|
|
|
// CHECK: define{{.*}} void @_ZN1S3vm1EPiS0_(ptr {{.*}}, {{.*}} noundef captures(address) {{%.*}})
|
|
void S::vm1(int *, int * __attribute__((noescape))) {}
|
|
|
|
// CHECK-LABEL: define{{.*}} void @_Z5test0P1SPiS1_(
|
|
// CHECK: call void @_ZN1SC1EPiS0_(ptr {{.*}}, {{.*}}, {{.*}} noundef captures(address) {{.*}})
|
|
// CHECK: call {{.*}} ptr @_ZN1SaSEPi(ptr {{.*}}, {{.*}} noundef captures(address) {{.*}})
|
|
// CHECK: call void @_ZN1S2m0EPiS0_(ptr {{.*}}, {{.*}}, {{.*}} noundef captures(address) {{.*}})
|
|
// CHECK: call void {{.*}}(ptr {{.*}}, {{.*}}, {{.*}} noundef captures(address) {{.*}})
|
|
void test0(S *s, int *p0, int *p1) {
|
|
S t(p0, p1);
|
|
t = p1;
|
|
s->m0(p0, p1);
|
|
s->vm1(p0, p1);
|
|
}
|
|
|
|
namespace std {
|
|
typedef decltype(sizeof(0)) size_t;
|
|
}
|
|
|
|
// CHECK: define {{.*}} @_ZnwmPv({{.*}}, {{.*}} captures(address) {{.*}})
|
|
void *operator new(std::size_t, void * __attribute__((noescape)) p) {
|
|
return p;
|
|
}
|
|
|
|
// CHECK-LABEL: define{{.*}} ptr @_Z5test1Pv(
|
|
// CHECK: %call = call {{.*}} @_ZnwmPv({{.*}}, {{.*}} captures(address) {{.*}})
|
|
void *test1(void *p0) {
|
|
return ::operator new(16, p0);
|
|
}
|
|
|
|
// CHECK-LABEL: define{{.*}} void @_Z5test2PiS_(
|
|
// CHECK: call void @"_ZZ5test2PiS_ENK3$_0clES_S_"({{.*}}, {{.*}}, {{.*}} captures(address) {{.*}})
|
|
// CHECK: define internal void @"_ZZ5test2PiS_ENK3$_0clES_S_"({{.*}}, {{.*}}, {{.*}} noundef captures(address) {{%.*}})
|
|
void test2(int *p0, int *p1) {
|
|
auto t = [](int *, int * __attribute__((noescape))){};
|
|
t(p0, p1);
|
|
}
|
|
|
|
// CHECK-LABEL: define{{.*}} void @_Z5test3PFvU8noescapePiES_(
|
|
// CHECK: call void {{.*}}(ptr noundef captures(address) {{.*}})
|
|
typedef void (*NoEscapeFunc)(__attribute__((noescape)) int *);
|
|
|
|
void test3(NoEscapeFunc f, int *p) {
|
|
f(p);
|
|
}
|
|
|
|
namespace TestByref {
|
|
|
|
struct S {
|
|
S();
|
|
~S();
|
|
S(const S &);
|
|
int a;
|
|
};
|
|
|
|
typedef void (^BlockTy)(void);
|
|
S &getS();
|
|
void noescapefunc(__attribute__((noescape)) BlockTy);
|
|
|
|
// Check that __block variables with reference types are handled correctly.
|
|
|
|
// CHECK: define{{.*}} void @_ZN9TestByref4testEv(
|
|
// CHECK: %[[X:.*]] = alloca ptr, align 8
|
|
// CHECK: %[[BLOCK:.*]] = alloca <{ ptr, i32, i32, ptr, ptr, ptr }>, align 8
|
|
// CHECK: %[[BLOCK_CAPTURED:.*]] = getelementptr inbounds nuw <{ ptr, i32, i32, ptr, ptr, ptr }>, ptr %[[BLOCK]], i32 0, i32 5
|
|
// CHECK: %[[V0:.*]] = load ptr, ptr %[[X]], align 8
|
|
// CHECK: store ptr %[[V0]], ptr %[[BLOCK_CAPTURED]], align 8
|
|
|
|
void test() {
|
|
__block S &x = getS();
|
|
noescapefunc(^{ (void)x; });
|
|
}
|
|
|
|
}
|