[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 2 07:50:51 PDT 2025


================
@@ -1482,3 +1482,10 @@ bool CapturedStmt::capturesVariable(const VarDecl *Var) const {
 
   return false;
 }
+
+Stmt *LoopControlStmt::getLabelTarget() const {
+  Stmt *Target = TargetLabel->getStmt();
+  while (isa_and_present<LabelStmt>(Target))
+    Target = cast<LabelStmt>(Target)->getSubStmt();
+  return Target;
----------------
Sirraide wrote:

I’ve added `getInnermostLabeledStmt()` because it seems like a useful thing to have, and I’ve renamed this function to `getNamedLoopOrSwitch()` to avoid having to write `getLabelDecl()->getStmt()->getInnermostLabeledStmt()` in a number of places.

https://github.com/llvm/llvm-project/pull/152870


More information about the cfe-commits mailing list