[clang] [clang-format] Fix parsing of goto labels (PR #196815)
via cfe-commits
cfe-commits at lists.llvm.org
Sun May 10 09:26:59 PDT 2026
github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results
* 87914 tests passed
* 1549 tests skipped
* 4 tests failed
## Failed Tests
(click on a test name to see its output)
### Clang-Unit
<details>
<summary>Clang-Unit.Format/_/FormatTests/FormatTest/ConfigurableSpaceBeforeColon</summary>
```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests --gtest_filter=FormatTest.ConfigurableSpaceBeforeColon
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "switch (x) {\ngoto_label: { break; }\ndefault : {\n break;\n}\n}"
FormattedCode
Which is: "switch (x) {\ngoto_label:\n {\n break;\n }\ndefault : {\n break;\n}\n}"
With diff:
@@ -1,4 +1,7 @@
switch (x) {
-goto_label: { break; }
+goto_label:
+ {
+ break;
+ }
default : {
break;
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:18599: switch (x) {
goto_label: { break; }
default : {
break;
}
}
```
</details>
<details>
<summary>Clang-Unit.Format/_/FormatTests/FormatTest/FormatIfWithoutCompoundStatement</summary>
```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests --gtest_filter=FormatTest.FormatIfWithoutCompoundStatement
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n if (a)\n label:\n f();\n}"
FormattedCode
Which is: "{\n if (a)\n label:\n f();\n}"
With diff:
@@ -2,4 +2,4 @@
if (a)
label:
- f();
+ f();
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:572: {
if (a)
label:
f();
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "#define A \\\n if (a) \\\n label: \\\n f()"
FormattedCode
Which is: "#define A \\\n if (a) \\\n label: \\\n f()"
With diff:
@@ -2,3 +2,3 @@
if (a) \\
label: \\
- f()
+ f()
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:577: #define A \
if (a) \
label: \
f()
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n MYIF (a)\n label:\n f();\n}"
FormattedCode
Which is: "{\n MYIF (a)\n label:\n f();\n}"
With diff:
@@ -2,4 +2,4 @@
MYIF (a)
label:
- f();
+ f();
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:608: {
MYIF (a)
label:
f();
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "#define A \\\n MYIF (a) \\\n label: \\\n f()"
FormattedCode
Which is: "#define A \\\n MYIF (a) \\\n label: \\\n f()"
With diff:
@@ -2,3 +2,3 @@
MYIF (a) \\
label: \\
- f()
+ f()
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:613: #define A \
MYIF (a) \
label: \
f()
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n if (a)\n label:\n f();\n else\n label:\n f();\n}"
FormattedCode
Which is: "{\n if (a)\n label:\n f();\n else label : f(); }"
With diff:
@@ -1,8 +1,5 @@
{
if (a)
- label:
- f();
- else
label:
- f();
-}
+ f();
+ else label : f(); }
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:672: {
if (a)
label:
f();
else
label:
f();
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n MYIF (a)\n label:\n f();\n else\n label:\n f();\n}"
FormattedCode
Which is: "{\n MYIF (a)\n label:\n f();\n else label : f(); }"
With diff:
@@ -1,8 +1,5 @@
{
MYIF (a)
- label:
- f();
- else
label:
- f();
-}
+ f();
+ else label : f(); }
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:721: {
MYIF (a)
label:
f();
else
label:
f();
}
```
</details>
<details>
<summary>Clang-Unit.Format/_/FormatTests/FormatTest/FormatLoopsWithoutCompoundStatement</summary>
```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests --gtest_filter=FormatTest.FormatLoopsWithoutCompoundStatement
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n do\n label:\n a++;\n while (true);\n}"
FormattedCode
Which is: "{\n do\n label:\n a++;\n while (true);\n}"
With diff:
@@ -2,5 +2,5 @@
do
label:
- a++;
+ a++;
while (true);
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:1451: {
do
label:
a++;
while (true);
}
```
</details>
<details>
<summary>Clang-Unit.Format/_/FormatTests/FormatTest/FormatsLabels</summary>
```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests --gtest_filter=FormatTest.FormatsLabels
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n some_code();\ntest_label:;\n int i = 0;\n}"
FormattedCode
Which is: "{\n some_code();\ntest_label:\n ;\n int i = 0;\n}"
With diff:
@@ -1,5 +1,6 @@
{
some_code();
-test_label:;
+test_label:
+ ;
int i = 0;
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:3139: {
some_code();
test_label:;
int i = 0;
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n some_code();\ntest_label: { some_other_code(); }\n}"
FormattedCode
Which is: "{\n some_code();\ntest_label:\n {\n some_other_code();\n }\n}"
With diff:
@@ -1,4 +1,7 @@
{
some_code();
-test_label: { some_other_code(); }
+test_label:
+ {
+ some_other_code();
+ }
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:3143: {
some_code();
test_label: { some_other_code(); }
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n some_code();\ntest_label: {\n some_other_code();\n some_other_code();\n}\n}"
FormattedCode
Which is: "{\n some_code();\ntest_label:\n {\n some_other_code();\n some_other_code();\n }\n}"
With diff:
@@ -1,7 +1,8 @@
{
some_code();
-test_label: {
- some_other_code();
- some_other_code();
-}
+test_label:
+ {
+ some_other_code();
+ some_other_code();
+ }
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:3150: {
some_code();
test_label: {
some_other_code();
some_other_code();
}
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n[[foo]] L1: {\n[[bar]] [[baz]] L2:\n g();\n}\n}"
FormattedCode
Which is: "{\n[[foo]] L1:\n {\n [[bar]] [[baz]] L2:\n g();\n }\n}"
With diff:
@@ -1,6 +1,7 @@
{
-[[foo]] L1: {
-[[bar]] [[baz]] L2:
- g();
-}
+[[foo]] L1:
+ {
+ [[bar]] [[baz]] L2:
+ g();
+ }
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:3162: {
[[foo]] L1: {
[[bar]] [[baz]] L2:
g();
}
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n some_code();\ntest_label:;\n int i = 0;\n}"
FormattedCode
Which is: "{\n some_code();\ntest_label:\n ;\n int i = 0;\n}"
With diff:
@@ -1,5 +1,6 @@
{
some_code();
-test_label:;
+test_label:
+ ;
int i = 0;
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:3215: {
some_code();
test_label:;
int i = 0;
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n some_code();\ntest_label: { some_other_code(); }\n}"
FormattedCode
Which is: "{\n some_code();\ntest_label:\n {\n some_other_code();\n }\n}"
With diff:
@@ -1,4 +1,7 @@
{
some_code();
-test_label: { some_other_code(); }
+test_label:
+ {
+ some_other_code();
+ }
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:3220: {
some_code();
test_label: { some_other_code(); }
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n some_code();\ntest_label:\n{\n some_other_code();\n}\n}"
FormattedCode
Which is: "{\n some_code();\ntest_label:\n {\n some_other_code();\n }\n}"
With diff:
@@ -2,6 +2,6 @@
some_code();
test_label:
-{
- some_other_code();
-}
+ {
+ some_other_code();
+ }
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:3357: {
some_code();
test_label:
{
some_other_code();
}
}
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
ExpectedCode
Which is: "{\n[[foo]] L1:\n{\n[[bar]] [[baz]] L2:\n g();\n}\n}"
FormattedCode
Which is: "{\n[[foo]] L1:\n {\n [[bar]] [[baz]] L2:\n g();\n }\n}"
With diff:
@@ -1,7 +1,7 @@
{
[[foo]] L1:
-{
-[[bar]] [[baz]] L2:
- g();
-}
+ {
+ [[bar]] [[baz]] L2:
+ g();
+ }
}
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:3365: {
[[foo]] L1:
{
[[bar]] [[baz]] L2:
g();
}
}
```
</details>
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.
https://github.com/llvm/llvm-project/pull/196815
More information about the cfe-commits
mailing list