| 1 |
// RUN: %clang_cc1 -triple arm64-apple-macosx14.0.0 -O0 -debug-info-kind=standalone -dwarf-version=5 \ |
| 2 |
// RUN: -fsanitize=vptr -fsanitize-trap=vptr -emit-llvm %s -o - | FileCheck %s |
| 3 |
|
| 4 |
struct A { |
| 5 |
virtual void foo(); |
| 6 |
}; |
| 7 |
struct B { |
| 8 |
virtual void bar(); |
| 9 |
}; |
| 10 |
|
| 11 |
void A::foo() {} |
| 12 |
void B::bar() {} |
| 13 |
|
| 14 |
int dynamic_type_cache_miss() { |
| 15 |
B b; |
| 16 |
A &a = reinterpret_cast<A &>(b); |
| 17 |
a.foo(); |
| 18 |
return 0; |
| 19 |
} |
| 20 |
|
| 21 |
// CHECK-LABEL: @_ZN1A3fooEv |
| 22 |
// CHECK-LABEL: @_ZN1B3barEv |
| 23 |
// CHECK-LABEL: @_Z23dynamic_type_cache_missv |
| 24 |
// CHECK: call void @llvm.ubsantrap(i8 4) {{.*}}!dbg [[LOC:![0-9]+]] |
| 25 |
// CHECK: [[LOC]] = !DILocation(line: 0, scope: [[MSG:![0-9]+]], {{.+}}) |
| 26 |
// CHECK: [[MSG]] = distinct !DISubprogram(name: "__clang_trap_msg$Undefined Behavior Sanitizer$Dynamic type cache miss, member call made on an object whose dynamic type differs from the expected type" |