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,
1516
1516
EmitStmt (S.getBody ());
1517
1517
}
1518
1518
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
+
1519
1523
EmitStopPoint (&S);
1520
1524
// If there is an increment, emit it next.
1521
1525
EmitBlock (Continue.getBlock ());
@@ -1542,7 +1546,7 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
1542
1546
1543
1547
// We want the for closing brace to be step-able on to match existing
1544
1548
// behaviour.
1545
- addInstToNewSourceAtom (ForBody ->getTerminator (), nullptr );
1549
+ addInstToNewSourceAtom (FinalBodyBB ->getTerminator (), nullptr );
1546
1550
}
1547
1551
1548
1552
void CodeGenFunction::EmitReturnOfRValue (RValue RV, QualType Ty) {
Original file line number Diff line number Diff line change 1
1
// 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
3
3
4
4
// Perennial question: should the inc be its own source atom or not
5
5
// (currently it is).
@@ -51,9 +51,22 @@ struct Range {
51
51
// CHECK-NEXT: ret void, !dbg [[DBG30:![0-9]+]]
52
52
//
53
53
void a () {
54
- for (int i: r)
55
- ;
54
+ for (int i: r)
55
+ ;
56
56
}
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
+
57
70
// .
58
71
// CHECK: [[DBG14]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
59
72
// CHECK: [[DBG15]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
@@ -69,4 +82,6 @@ void a() {
69
82
// CHECK: [[DBG25]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 2)
70
83
// CHECK: [[DBG26]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 1)
71
84
// CHECK: [[DBG30]] = !DILocation({{.*}})
85
+ //
86
+ // CHECK: [[b_br]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
72
87
// .
You can’t perform that action at this time.
0 commit comments