1 // RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-mfcall -fsanitize-trap=cfi-mfcall -fvisibility=hidden -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-mfcall -fsanitize-trap=cfi-mfcall -fvisibility=default -emit-llvm -o - %s | FileCheck --check-prefix=DEFAULT %s
3 // With -fwhole-program-vtables we should get the member function pointer type
4 // test, even without hidden visibility.
5 // RUN: %clang_cc1 -triple x86_64-unknown-linux -fwhole-program-vtables -emit-llvm -o - %s | FileCheck %s --check-prefix=WPV
12 // DEFAULT-NOT: llvm.type.test
13 // DEFAULT-NOT: llvm.public.type.test
15 void f(S
*s
, void (S::*p
)()) {
16 // WPV: [[OFFSET:%.*]] = sub i64 {{.*}}, 1
17 // WPV: [[VFPTR:%.*]] = getelementptr i8, ptr %{{.*}}, i64 [[OFFSET]]
18 // WPV: [[TT:%.*]] = call i1 @llvm.public.type.test(ptr [[VFPTR]], metadata !"_ZTSM1SFvvE.virtual")
19 // CHECK: [[OFFSET:%.*]] = sub i64 {{.*}}, 1
20 // CHECK: [[VFPTR:%.*]] = getelementptr i8, ptr %{{.*}}, i64 [[OFFSET]]
21 // CHECK: [[TT:%.*]] = call i1 @llvm.type.test(ptr [[VFPTR]], metadata !"_ZTSM1SFvvE.virtual")
22 // CHECK: br i1 [[TT]], label {{.*}}, label %[[TRAP1:[^,]*]]
25 // CHECK-NEXT: llvm.ubsantrap
27 // CHECK: [[TT1:%.*]] = call i1 @llvm.type.test(ptr {{.*}}, metadata !"_ZTSM2B1FvvE")
28 // CHECK: [[OR1:%.*]] = or i1 false, [[TT1]]
29 // CHECK: [[TT2:%.*]] = call i1 @llvm.type.test(ptr {{.*}}, metadata !"_ZTSM2B2FvvE")
30 // CHECK: [[OR2:%.*]] = or i1 [[OR1]], [[TT2]]
31 // CHECK: br i1 [[OR2]], label {{.*}}, label %[[TRAP2:[^,]*]]
34 // CHECK-NEXT: llvm.ubsantrap