File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
test/DebugInfo/KeyInstructions Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -1516,6 +1516,10 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
15161516 EmitStmt (S.getBody ());
15171517 }
15181518
1519+ // The last block in the loop's body (which unconditionally branches to theAdd commentMore actions
1520+ // `inc` block if there is one).
1521+ auto *FinalBodyBB = Builder.GetInsertBlock ();
1522+
15191523 EmitStopPoint (&S);
15201524 // If there is an increment, emit it next.
15211525 EmitBlock (Continue.getBlock ());
@@ -1542,7 +1546,7 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
15421546
15431547 // We want the for closing brace to be step-able on to match existing
15441548 // behaviour.
1545- addInstToNewSourceAtom (ForBody ->getTerminator (), nullptr );
1549+ addInstToNewSourceAtom (FinalBodyBB ->getTerminator (), nullptr );
15461550}
15471551
15481552void CodeGenFunction::EmitReturnOfRValue (RValue RV, QualType Ty) {
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions %s -debug-info-kind=line-tables-only -emit-llvm -o - \
2- // RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
2+ // RUN: | FileCheck %s
33
44// Perennial question: should the inc be its own source atom or not
55// (currently it is).
@@ -51,9 +51,22 @@ struct Range {
5151// CHECK-NEXT: ret void, !dbg [[DBG30:![0-9]+]]
5252//
5353void a () {
54- for (int i: r)
55- ;
54+ for (int i: r)
55+ ;
5656}
57+
58+ // - Check the branch out of the body gets an atom group (and gets it correct
59+ // if there's ctrl-flow in the body).
60+ void b () {
61+ for (int i: r) {
62+ if (i)
63+ ;
64+ // CHECK: entry:
65+ // CHECK: if.end:
66+ // CHECK-NEXT: br label %for.inc, !dbg [[b_br:!.*]]
67+ }
68+ }
69+
5770// .
5871// CHECK: [[DBG14]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
5972// CHECK: [[DBG15]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
@@ -69,4 +82,6 @@ void a() {
6982// CHECK: [[DBG25]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 2)
7083// CHECK: [[DBG26]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 1)
7184// CHECK: [[DBG30]] = !DILocation({{.*}})
85+ //
86+ // CHECK: [[b_br]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
7287// .
You can’t perform that action at this time.
0 commit comments