[clang] [Clang] Disallow `break`/`continue` in loop conditions (PR #198436)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 20 06:59:15 PDT 2026
================
@@ -636,6 +622,16 @@ class Scope {
/// is an ancestor of the other.
bool Contains(const Scope& rhs) const { return Depth < rhs.Depth; }
+ /// Mark that we're entering the body of a loop (for, while, do).
+ void EnterLoopBody(LabelDecl *PrecedingLabel);
+
+ /// Mark that we're entering the body of a switch statement.
+ void EnterSwitchBody(LabelDecl *PrecedingLabel);
+
+ /// Mark that we're leaving the body of a loop; this is only needed for do
+ /// loops where the condition follows the loop body.
+ void LeaveLoopBody();
----------------
Sirraide wrote:
I mean, it does the opposite of `EnterLoopBody` so I think the name is fine ;Þ
https://github.com/llvm/llvm-project/pull/198436
More information about the cfe-commits
mailing list