]> granicus.if.org Git - clang/commitdiff
DebugInfo: Test that the loop backedge in a range-for is attribute to the loop header.
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 22 Aug 2014 22:29:50 +0000 (22:29 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 22 Aug 2014 22:29:50 +0000 (22:29 +0000)
This already works, but somewhat by accident (due to the order of
emission in clang, the location is set to the loop header (during the
emission of the iteratior increment) before the loop backedge is
emitted), so let's just add a test for symmetry and future-proofing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216298 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGenCXX/debug-info-line-if.cpp

index 6319993b14b10878308eaafcc8be576dbe679f47..bd9637732523970d55edc98e41410e3fcbad1729 100644 (file)
@@ -37,7 +37,19 @@ int main() {
   // CHECK: br label
   // CHECK: br label {{.*}}, !dbg [[DBG3:!.*]]
 
+#line 400
+  int x[] = {1, 2};
+  for (int y : x)
+    if (b)
+      ++b; // CHECK: add nsw{{.*}}, 1
+    else
+      ++a; // CHECK: add nsw{{.*}}, 1
+
+  // CHECK: br label
+  // CHECK: br label {{.*}}, !dbg [[DBG4:!.*]]
+
   // CHECK: [[DBG1]] = metadata !{i32 100, i32 0, metadata !{{.*}}, null}
   // CHECK: [[DBG2]] = metadata !{i32 200, i32 0, metadata !{{.*}}, null}
   // CHECK: [[DBG3]] = metadata !{i32 300, i32 0, metadata !{{.*}}, null}
+  // CHECK: [[DBG4]] = metadata !{i32 401, i32 0, metadata !{{.*}}, null}
 }