[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
Sun Aug 17 09:05:54 PDT 2025


================
@@ -758,6 +758,24 @@ TEST(ConfigParseTest, ParsesConfiguration) {
               "  AfterControlStatement: false",
               BraceWrapping.AfterControlStatement, FormatStyle::BWACS_Never);
 
+  Style.BraceWrapping.WrapEmptyRecord = FormatStyle::BWER_Default;
+  CHECK_PARSE("BraceWrapping:\n"
+              "  WrapEmptyRecord: BeforeBrace",
+              BraceWrapping.WrapEmptyRecord, FormatStyle::BWER_BeforeBrace);
+  CHECK_PARSE("BraceWrapping:\n"
+              "  WrapEmptyRecord: Default",
+              BraceWrapping.WrapEmptyRecord, FormatStyle::BWER_Default);
+  CHECK_PARSE("BraceWrapping:\n"
+              "  WrapEmptyRecord: Never",
+              BraceWrapping.WrapEmptyRecord, FormatStyle::BWER_Never);
+  // For backward compatibility:
----------------
HazardyKnusperkeks wrote:

Please extent it to check the old name, also the combination in both orders (that the new one wins).

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


More information about the cfe-commits mailing list