================
@@ -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;
----------------
erichkeane wrote:
The name similarity between `TargetLabel` (which stores the label) and
`LabelTarget` is pretty confusing/awkward. It seems that this is attempting to
get the control statement kind that this refers to, right? So the
`for`/`while`/`switch`/etc?
I wonder if INSTEAD this should JUST return the `TargetLabel`, and add a
function to `LabelStmt` that is `getInnermostLabeledStmt` or something (choose
a better name). This way it is more clear what is actually going on here (this
is/was quite confusing for me so far).
https://github.com/llvm/llvm-project/pull/152870
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits