Skip to content

Commit 9ae3232

Browse files
committed
break
1 parent c0c9623 commit 9ae3232

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

clang/lib/CodeGen/CGStmt.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,7 @@ void CodeGenFunction::EmitBreakStmt(const BreakStmt &S) {
17151715
if (HaveInsertPoint())
17161716
EmitStopPoint(&S);
17171717

1718+
ApplyAtomGroup Grp(getDebugInfo());
17181719
EmitBranchThroughCleanup(BreakContinueStack.back().BreakBlock);
17191720
}
17201721

clang/test/DebugInfo/KeyInstructions/for.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ void e() {
106106
}
107107
}
108108

109+
void f() {
110+
// - Check the `break` keyword gets an atom group.
111+
// CHECK: entry:
112+
// CHECK-NEXT: br label %for.cond
113+
114+
// CHECK: for.cond:
115+
// CHECK: br label %for.end, !dbg [[fG1R1:!.*]]
116+
for ( ; ; )
117+
{
118+
break;
119+
}
120+
}
121+
109122
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
110123
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
111124
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
@@ -131,3 +144,5 @@ void e() {
131144
// CHECK: [[dG1R1]] = !DILocation(line: 91, column: 3, scope: ![[#]], atomGroup: 1, atomRank: 1)
132145

133146
// CHECK: [[eG1R1]] = !DILocation(line: 105, column: 5, scope: ![[#]], atomGroup: 1, atomRank: 1)
147+
148+
// CHECK: [[fG1R1]] = !DILocation(line: 118, column: 5, scope: ![[#]], atomGroup: 1, atomRank: 1)

clang/test/DebugInfo/KeyInstructions/switch.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,36 @@ void a(int A, int B) {
1616
// CHECK: i32 1, label %sw.bb1
1717
// CHECK: ], !dbg [[G2R1:!.*]]
1818
switch ((g = A)) {
19+
// CHECK: br label %sw.epilog[[#]], !dbg [[G3R1:!.*]]
1920
case 0: break;
2021
case 1: {
2122
// CHECK: sw.bb1:
22-
// CHECK: %1 = load i32, ptr %B.addr{{.*}}, !dbg [[G3R2:!.*]]
23+
// CHECK: %1 = load i32, ptr %B.addr{{.*}}, !dbg [[G4R2:!.*]]
2324
// CHECK: switch i32 %1, label %{{.*}} [
2425
// CHECK: i32 0, label %sw.bb2
25-
// CHECK: ], !dbg [[G3R1:!.*]]
26+
// CHECK: ], !dbg [[G4R1:!.*]]
2627
switch ((B)) {
2728
case 0: {
2829
// Test that assignments in constant-folded switches don't go missing.
2930
// CHECK-CXX: sw.bb2:
30-
// CHECK-CXX: store i32 1, ptr %C{{.*}}, !dbg [[G4R1:!.*]]
31+
// CHECK-CXX: store i32 1, ptr %C{{.*}}, !dbg [[G5R1:!.*]]
3132
#ifdef __cplusplus
3233
switch (const int C = 1; C) {
3334
case 0: break;
3435
case 1: break;
3536
default: break;
3637
}
3738
#endif
38-
} break;
39-
default: break;
39+
};
4040
}
41-
} break;
42-
default: break;
41+
};
4342
}
4443
}
4544

4645
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
4746
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
4847
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
49-
// CHECK: [[G3R2]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 2)
5048
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
51-
// CHECK-CXX: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
49+
// CHECK: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2)
50+
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
51+
// CHECK-CXX: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1)

0 commit comments

Comments
 (0)