[clang] [clang] Mark labels referenced when used in named break or continue (PR #166033)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 3 05:01:56 PST 2025


================
@@ -3315,6 +3315,8 @@ StmtResult Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope,
                                    LabelDecl *Target, SourceLocation LabelLoc) {
   Scope *S;
   if (Target) {
+    MarkAnyDeclReferenced(Target->getLocation(), Target,
+                          /*MightBeOdrUse=*/false);
----------------
Sirraide wrote:

```suggestion
    Target->markUsed(Context);
```
Can you also move this into `FindLabeledBreakContinueScope()` instead?

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


More information about the cfe-commits mailing list