1 // RUN: %clang_cc1 -debug-info-kind=limited -gno-column-info -std=c++11 -emit-llvm %s -o -| FileCheck %s
3 // Two variables with the same name in subsequent if staments need to be in separate scopes.
10 // CHECK: = !DILocalVariable(name: "i"
11 // CHECK-SAME: scope: [[IF1:![0-9]*]]
12 // CHECK-SAME: line: [[@LINE+2]]
13 // CHECK: [[IF1]] = distinct !DILexicalBlock({{.*}}line: [[@LINE+1]])
17 // CHECK: = !DILocalVariable(name: "i"
18 // CHECK-SAME: scope: [[IF2:![0-9]*]]
19 // CHECK-SAME: line: [[@LINE+2]]
20 // CHECK: [[IF2]] = distinct !DILexicalBlock({{.*}}line: [[@LINE+1]])
26 // CHECK: = !DILocalVariable(name: "i"
27 // CHECK-SAME: scope: [[FOR:![0-9]*]]
28 // CHECK-SAME: line: [[@LINE+2]]
29 // CHECK: [[FOR]] = distinct !DILexicalBlock({{.*}}line: [[@LINE+1]])
31 // CHECK: = !DILocalVariable(name: "b"
32 // CHECK-SAME: scope: [[FOR_BODY:![0-9]*]]
33 // CHECK-SAME: line: [[@LINE+6]]
34 // CHECK: [[FOR_BODY]] = distinct !DILexicalBlock({{.*}}line: [[@LINE-4]])
35 // The scope could be located at 'bool b', but LLVM drops line information for
36 // scopes anyway, so it's not terribly important.
37 // FIXME: change the debug info schema to not include locations of scopes,
38 // since they're not used.
39 bool b
= i
!= 10; ++i
)
42 // CHECK: = !DILocalVariable(name: "i"
43 // CHECK-SAME: scope: [[FOR:![0-9]*]]
44 // CHECK-SAME: line: [[@LINE+2]]
45 // CHECK: [[FOR]] = distinct !DILexicalBlock({{.*}}line: [[@LINE+1]])
46 for (int i
= 0; i
!= 10; ++i
) {
47 // FIXME: Do not include scopes that have only other scopes (and no variables
48 // or using declarations) as direct children, they just waste
49 // space/relocations/etc.
50 // CHECK: [[FOR_LOOP_INCLUDING_COND:!.*]] = distinct !DILexicalBlock(scope: [[FOR]],{{.*}} line: [[@LINE-4]])
51 // CHECK: = !DILocalVariable(name: "b"
52 // CHECK-SAME: scope: [[FOR_COMPOUND:![0-9]*]]
53 // CHECK-SAME: line: [[@LINE+2]]
54 // CHECK: [[FOR_COMPOUND]] = distinct !DILexicalBlock(scope: [[FOR_LOOP_INCLUDING_COND]],{{.*}} line: [[@LINE-8]])
59 // CHECK: = !DILocalVariable(name: "__range1"
60 // CHECK-SAME: scope: [[RANGE_FOR:![0-9]*]]
63 // CHECK: [[RANGE_FOR]] = distinct !DILexicalBlock({{.*}}, line: [[@LINE+1]])
65 // CHECK: = !DILocalVariable(name: "i"
66 // CHECK-SAME: scope: [[RANGE_FOR_BODY:![0-9]*]]
67 // CHECK-SAME: line: [[@LINE-3]]
68 // CHECK: [[RANGE_FOR_BODY]] = distinct !DILexicalBlock(scope: [[RANGE_FOR]],{{.*}} line: [[@LINE-4]])