From: David Blaikie Date: Fri, 22 Aug 2014 22:29:50 +0000 (+0000) Subject: DebugInfo: Test that the loop backedge in a range-for is attribute to the loop header. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91d7339375532eb2129db41212b0a4b8b6ef7063;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216298 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/debug-info-line-if.cpp b/test/CodeGenCXX/debug-info-line-if.cpp index 6319993b14..bd96377325 100644 --- a/test/CodeGenCXX/debug-info-line-if.cpp +++ b/test/CodeGenCXX/debug-info-line-if.cpp @@ -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} }