| 1 |
// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s |
| 2 |
|
| 3 |
// CHECK-LABEL: define void @_Z2f0v() |
| 4 |
// CHECK: call void @llvm.trap(), !dbg ![[LOC17:.*]] |
| 5 |
|
| 6 |
// CHECK: declare void @llvm.trap() #[[ATTR1:.*]] |
| 7 |
|
| 8 |
// CHECK-LABEL: define void @_Z2f1v() |
| 9 |
// CHECK: call void @llvm.trap(), !dbg ![[LOC23:.*]] |
| 10 |
// CHECK: call void @llvm.trap(), !dbg ![[LOC25:.*]] |
| 11 |
|
| 12 |
// CHECK-LABEL: define void @_Z2f3v() |
| 13 |
// CHECK: call void @_Z2f2IXadsoKcL_ZL8constCatEEEXadsoS0_L_ZL8constMsgEEEEvv() |
| 14 |
|
| 15 |
// CHECK-LABEL: define internal void @_Z2f2IXadsoKcL_ZL8constCatEEEXadsoS0_L_ZL8constMsgEEEEvv |
| 16 |
// CHECK: call void @llvm.trap(), !dbg ![[LOC36:.*]] |
| 17 |
|
| 18 |
// CHECK: attributes #[[ATTR1]] = { cold {{.*}}} |
| 19 |
|
| 20 |
// CHECK: ![[FILESCOPE:.*]] = !DIFile(filename: "{{.*}}verbose-trap.cpp" |
| 21 |
|
| 22 |
char const constCat[] = "category2"; |
| 23 |
char const constMsg[] = "hello"; |
| 24 |
|
| 25 |
// CHECK: ![[SUBPROG14:.*]] = distinct !DISubprogram(name: "f0", linkageName: "_Z2f0v", |
| 26 |
// CHECK: ![[LOC17]] = !DILocation(line: 0, scope: ![[SUBPROG18:.*]], inlinedAt: ![[LOC20:.*]]) |
| 27 |
// CHECK: ![[SUBPROG18]] = distinct !DISubprogram(name: "__clang_trap_msg$category1$Argument_must_not_be_null", scope: ![[FILESCOPE]], file: ![[FILESCOPE]], type: !{{.*}}, flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: !{{.*}}) |
| 28 |
// CHECK: ![[LOC20]] = !DILocation(line: [[@LINE+2]], column: 3, scope: ![[SUBPROG14]]) |
| 29 |
void f0() { |
| 30 |
__builtin_verbose_trap("category1", "Argument_must_not_be_null"); |
| 31 |
} |
| 32 |
|
| 33 |
// CHECK: ![[SUBPROG22:.*]] = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1v", |
| 34 |
// CHECK: ![[LOC23]] = !DILocation(line: 0, scope: ![[SUBPROG18]], inlinedAt: ![[LOC24:.*]]) |
| 35 |
// CHECK: ![[LOC24]] = !DILocation(line: [[@LINE+5]], column: 3, scope: ![[SUBPROG22]]) |
| 36 |
// CHECK: ![[LOC25]] = !DILocation(line: 0, scope: ![[SUBPROG26:.*]], inlinedAt: ![[LOC27:.*]]) |
| 37 |
// CHECK: ![[SUBPROG26]] = distinct !DISubprogram(name: "__clang_trap_msg$category2$hello", scope: ![[FILESCOPE]], file: ![[FILESCOPE]], type: !{{.*}}, flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: !{{.*}}) |
| 38 |
// CHECK: ![[LOC27]] = !DILocation(line: [[@LINE+3]], column: 3, scope: ![[SUBPROG22]]) |
| 39 |
void f1() { |
| 40 |
__builtin_verbose_trap("category1", "Argument_must_not_be_null"); |
| 41 |
__builtin_verbose_trap("category2", "hello"); |
| 42 |
} |
| 43 |
|
| 44 |
// CHECK: ![[SUBPROG32:.*]] = distinct !DISubprogram(name: "f2<constCat, constMsg>", linkageName: "_Z2f2IXadsoKcL_ZL8constCatEEEXadsoS0_L_ZL8constMsgEEEEvv", |
| 45 |
// CHECK: ![[LOC36]] = !DILocation(line: 0, scope: ![[SUBPROG26]], inlinedAt: ![[LOC37:.*]]) |
| 46 |
// CHECK: ![[LOC37]] = !DILocation(line: [[@LINE+3]], column: 3, scope: ![[SUBPROG32]]) |
| 47 |
template <const char * const category, const char * const reason> |
| 48 |
void f2() { |
| 49 |
__builtin_verbose_trap(category, reason); |
| 50 |
} |
| 51 |
|
| 52 |
void f3() { |
| 53 |
f2<constCat, constMsg>(); |
| 54 |
} |