[clang] [clang-format] Add option AllowShortRecordOnASingleLine (PR #154580)

Tomáš Slanina via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 26 15:13:14 PDT 2025


================
@@ -1553,6 +1563,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
   LLVMStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_All;
   LLVMStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
   LLVMStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_All;
+  LLVMStyle.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never;
----------------
itzexpoexpo wrote:

Making `Empty` the default makes sense but will mess with configs that derive from LLVM, i.e. with this config:
```
BasedOnStyle: LLVM
BreakBeforeBraces: Custom
BraceWrapping:
  AfterClass: true
  SplitEmptyRecord: false
```
We would expect:
```c++
class foo
{};

class bar
{
  int i;
};
```
but get instead:
```
class foo {};

class bar
{
  int i;
};
```
Unsure how to handle this, or if it's a minor enough breaking change that it doesn't matter?

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


More information about the cfe-commits mailing list