r216298 - DebugInfo: Test that the loop backedge in a range-for is attribute to the loop header.

David Blaikie dblaikie at gmail.com
Fri Aug 22 15:29:50 PDT 2014


Author: dblaikie
Date: Fri Aug 22 17:29:50 2014
New Revision: 216298

URL: http://llvm.org/viewvc/llvm-project?rev=216298&view=rev
Log:
DebugInfo: Test that the loop backedge in a range-for is attribute to the loop header.

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.

Modified:
    cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp

Modified: cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp?rev=216298&r1=216297&r2=216298&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp Fri Aug 22 17:29:50 2014
@@ -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}
 }





More information about the cfe-commits mailing list