Debian Codegraph @

clang/test/CodeGen/ptrauth-ubsan-vptr.cpp

raw
1 // RUN: %clang_cc1 -triple arm64e-apple-ios15 -fsanitize=vptr -O0 -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple arm64e-apple-ios15 -fsanitize=vptr -O2 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
3
4 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fsanitize=vptr -O0 -emit-llvm -o - %s | FileCheck %s
5 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fsanitize=vptr -O2 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
6
7 struct S {
8 S() {}
9 ~S() {}
10 virtual int v() { return 0; }
11 int a;
12 };
13
14 struct T : public S {
15 virtual int v();
16 };
17
18 // CHECK-LABEL: foo1
19 int foo1(void* Buffer) {
20 T *p = reinterpret_cast<T*>(Buffer);
21 return p->v();
22 }
23 // CHECK-NOT: call {{.*}} @llvm.ptrauth.auth{{.*}}
24 // CHECK-NOT: call {{.*}} @llvm.ptrauth.strip{{.*}}
25
26 // CHECK-LABEL: foo2
27 int foo2(S* s) {
28 T *p = dynamic_cast<T*>(s);
29 return p->v();
30 }
31
32 // CHECK-NOT: call {{.*}} @llvm.ptrauth.auth{{.*}}
33 // CHECK-NOT: call {{.*}} @llvm.ptrauth.strip{{.*}}