llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-format Author: Owen Pan (owenca) <details> <summary>Changes</summary> Fixes #<!-- -->113256. --- Full diff: https://github.com/llvm/llvm-project/pull/113257.diff 2 Files Affected: - (modified) clang/lib/Format/UnwrappedLineParser.cpp (+5) - (modified) clang/unittests/Format/FormatTestCSharp.cpp (+19-9) ``````````diff diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 4a5109983dfcc5..ebb9f4c7da8313 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1568,6 +1568,11 @@ void UnwrappedLineParser::parseStructuralElement( } parseCaseLabel(); return; + case tok::kw_goto: + nextToken(); + if (FormatTok->is(tok::kw_case)) + nextToken(); + break; case tok::kw_try: case tok::kw___try: if (Style.isJavaScript() && Line->MustBeDeclaration) { diff --git a/clang/unittests/Format/FormatTestCSharp.cpp b/clang/unittests/Format/FormatTestCSharp.cpp index 0c5afa1524374d..151f7072e0c657 100644 --- a/clang/unittests/Format/FormatTestCSharp.cpp +++ b/clang/unittests/Format/FormatTestCSharp.cpp @@ -1689,15 +1689,25 @@ TEST_F(FormatTestCSharp, BrokenBrackets) { } TEST_F(FormatTestCSharp, GotoCaseLabel) { - verifyNoCrash("switch (i) {\n" - "case 0:\n" - " goto case 1;\n" - "case 1:\n" - " j = 0;\n" - " {\n" - " break;\n" - " }\n" - "}"); + verifyFormat("switch (i)\n" + "{\n" + "case 0:\n" + " goto case 1;\n" + "case 1:\n" + " j = 0;\n" + " {\n" + " break;\n" + " }\n" + "}", + "switch (i) {\n" + "case 0:\n" + " goto case 1;\n" + "case 1:\n" + " j = 0;\n" + " {\n" + " break;\n" + " }\n" + "}"); } } // namespace `````````` </details> https://github.com/llvm/llvm-project/pull/113257 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits