| 1 | // This test will test the correctness of generating DILabel and |
| 2 | // llvm.dbg.label when the label is in inlined functions. |
| 3 | // |
| 4 | // RUN: %clang_cc1 -O2 %s -o - -emit-llvm -debug-info-kind=limited | FileCheck %s |
| 5 | inline int f1(int a, int b) { |
| 6 | int sum; |
| 7 | |
| 8 | top: |
| 9 | sum = a + b; |
| 10 | return sum; |
| 11 | } |
| 12 | |
| 13 | extern int ga, gb; |
| 14 | |
| 15 | int f2(void) { |
| 16 | int result; |
| 17 | |
| 18 | result = f1(ga, gb); |
| 19 | // CHECK: call void @llvm.dbg.label(metadata [[LABEL_METADATA:!.*]]), !dbg [[LABEL_LOCATION:!.*]] |
| 20 | |
| 21 | return result; |
| 22 | } |
| 23 | |
| 24 | // CHECK: distinct !DISubprogram(name: "f1", {{.*}}, retainedNodes: [[ELEMENTS:!.*]]) |
| 25 | // CHECK: [[ELEMENTS]] = !{{{.*}}, [[LABEL_METADATA]]} |
| 26 | // CHECK: [[LABEL_METADATA]] = !DILabel({{.*}}, name: "top", {{.*}}, line: 8) |
| 27 | // CHECK: [[INLINEDAT:!.*]] = distinct !DILocation(line: 18, |
| 28 | // CHECK: [[LABEL_LOCATION]] = !DILocation(line: 8, {{.*}}, inlinedAt: [[INLINEDAT]]) |
| 29 | |