[clang] [clang][AST] Fix crash on labeled break/continue within switch condition statement expression (PR #228655)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 04:36:00 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions c,cpp,h -- clang/include/clang/AST/Stmt.h clang/lib/AST/ASTImporter.cpp clang/lib/AST/ByteCode/Compiler.cpp clang/lib/AST/ByteCode/Interp.h clang/lib/AST/ExprConstant.cpp clang/lib/AST/JSONNodeDumper.cpp clang/lib/AST/Stmt.cpp clang/lib/AST/StmtPrinter.cpp clang/lib/AST/TextNodeDumper.cpp clang/lib/CodeGen/CGStmt.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTWriterStmt.cpp clang/test/CodeGen/labeled-break-continue.c clang/test/SemaCXX/labeled-break-continue.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 9036091d9..e29d49d7e 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -3716,7 +3716,8 @@ inline bool Unsupported(InterpState &S, CodePtr OpPC) {
 }
 
 inline bool InvalidTargetLabel(InterpState &S, CodePtr OpPC, bool IsContinue) {
-  S.FFDiag(S.Current->getLocation(OpPC), diag::note_break_continue_label_outside_context)
+  S.FFDiag(S.Current->getLocation(OpPC),
+           diag::note_break_continue_label_outside_context)
       << S.Current->getRange(OpPC) << IsContinue;
   return false;
 }

``````````

</details>


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


More information about the cfe-commits mailing list