[clang] [clang-format] Add option to omit wrapping for empty records (PR #151970)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 11 06:41:42 PDT 2025


================
@@ -15615,6 +15615,36 @@ TEST_F(FormatTest, NeverMergeShortRecords) {
                Style);
 }
 
+TEST_F(FormatTest, WrapEmptyRecords) {
+  FormatStyle Style = getLLVMStyle();
+
+  Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+  Style.BraceWrapping.AfterStruct = true;
+  Style.BraceWrapping.AfterClass = true;
+  Style.BraceWrapping.AfterUnion = true;
+  Style.BraceWrapping.SplitEmptyRecord = false;
+
+  verifyFormat("class foo\n{\n  void bar();\n};", Style);
----------------
HazardyKnusperkeks wrote:

```suggestion
  verifyFormat("class foo\n{\n"
  "  void bar();\n"
  "};", Style);
```
Some for all other tests.

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


More information about the cfe-commits mailing list