72 lines · cpp
1// RUN: %clang_cc1 -debug-info-kind=limited -gno-column-info -std=c++11 -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s2// PR198643extern int v[2];4int a = 0, b = 0;5int main() {6#line 1007 for (int x : v)8 if (x)9 ++b; // CHECK: add nsw{{.*}}, 110 else11 ++a; // CHECK: add nsw{{.*}}, 112 // The continuation block if the if statement should not share the13 // location of the ++a statement. The branch back to the start of the loop14 // should be attributed to the loop header line.15 16 // CHECK: br label17 // CHECK: br label18 // CHECK: br label {{.*}}, !dbg [[DBG1:![0-9]*]], !llvm.loop [[L1:![0-9]*]]19 20#line 20021 while (a)22 if (b)23 ++b; // CHECK: add nsw{{.*}}, 124 else25 ++a; // CHECK: add nsw{{.*}}, 126 27 // CHECK: br label28 // CHECK: br label {{.*}}, !dbg [[DBG2:![0-9]*]], !llvm.loop [[L2:![0-9]*]]29 30#line 30031 for (; a; )32 if (b)33 ++b; // CHECK: add nsw{{.*}}, 134 else35 ++a; // CHECK: add nsw{{.*}}, 136 37 // CHECK: br label38 // CHECK: br label {{.*}}, !dbg [[DBG3:![0-9]*]], !llvm.loop [[L3:![0-9]*]]39 40#line 40041 int x[] = {1, 2};42 for (int y : x)43 if (b)44 ++b; // CHECK: add nsw{{.*}}, 145 else46 ++a; // CHECK: add nsw{{.*}}, 147 48 // CHECK: br label49 // CHECK: br label {{.*}}, !dbg [[DBG4:![0-9]*]], !llvm.loop [[L4:![0-9]*]]50 51 // CHECK-DAG: [[DBG1]] = !DILocation(line: 100, scope: !{{.*}})52 // CHECK-DAG: [[DBG2]] = !DILocation(line: 200, scope: !{{.*}})53 // CHECK-DAG: [[DBG3]] = !DILocation(line: 300, scope: !{{.*}})54 // CHECK-DAG: [[DBG4]] = !DILocation(line: 401, scope: !{{.*}})55 56 // CHECK-DAG: [[L1]] = distinct !{[[L1]], [[SLDBG1:![0-9]*]], [[ELDBG1:![0-9]*]]}57 // CHECK-DAG: [[SLDBG1]] = !DILocation(line: 100, scope: !{{.*}})58 // CHECK-DAG: [[ELDBG1]] = !DILocation(line: 104, scope: !{{.*}})59 60 // CHECK-DAG: [[L2]] = distinct !{[[L2]], [[SLDBG2:![0-9]*]], [[ELDBG2:![0-9]*]], [[MP:![0-9]+]]}61 // CHECK-DAG: [[SLDBG2]] = !DILocation(line: 200, scope: !{{.*}})62 // CHECK-DAG: [[ELDBG2]] = !DILocation(line: 204, scope: !{{.*}})63 64 // CHECK-DAG: [[L3]] = distinct !{[[L3]], [[SLDBG3:![0-9]*]], [[ELDBG3:![0-9]*]], [[MP]]}65 // CHECK-DAG: [[SLDBG3]] = !DILocation(line: 300, scope: !{{.*}})66 // CHECK-DAG: [[ELDBG3]] = !DILocation(line: 304, scope: !{{.*}})67 68 // CHECK-DAG: [[L4]] = distinct !{[[L4]], [[SLDBG4:![0-9]*]], [[ELDBG4:![0-9]*]]}69 // CHECK-DAG: [[SLDBG4]] = !DILocation(line: 401, scope: !{{.*}})70 // CHECK-DAG: [[ELDBG4]] = !DILocation(line: 405, scope: !{{.*}})71}72