[PATCH] D148484: [clang-format] Correctly format goto labels followed by blocks

sstwcw via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 16 16:52:19 PDT 2023


sstwcw added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:714
     // are in a control flow statements as well as several style flags.
-    if (Line.First->is(tok::kw_case) ||
+    if (Line.First->is(tok::kw_case) || Line.Last->is(TT_GotoLabelColon) ||
+        Line.Last->endsSequence(tok::l_brace, TT_GotoLabelColon) ||
----------------
Should I make this change?

Without it:

```
label: { break; }
```

With it:

```
label: {
  break;
}
```

Without the entire patch:

```
label : { break; }
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148484/new/

https://reviews.llvm.org/D148484



More information about the cfe-commits mailing list