[clang] [clang-format] Add option AllowShortRecordOnASingleLine (PR #154580)
Tomáš Slanina via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 24 15:31:13 PDT 2025
itzexpoexpo wrote:
> The command-line option `-style='{AllowShortRecordsOnASingleLine: Never}'` I used in the example implies `AfterClass: false`, so `SplitEmptyRecord` doesn't matter. See https://github.com/llvm/llvm-project/issues/154796#issuecomment-3218392876.
The same code that merges the brace for `SplitEmptyRecord` does the same for `AllowShortRecordOnASingleLine` since `Never` is treated as "option ignored", changing it so that the behavior is overriden means with the default config you'd get:
```c++
struct foo {
};
```
from your comment I understood this behavior is not to be changed?
> `SplitEmptyRecord: true`, which is effective here, should override `AllowShortRecordsOnASingleLine` for empty records.
Right, so is the expected behavior this:
```c++
$ clang-format -style="{AllowShortRecordsOnASingleLine: Empty, BraceWrapping: {AfterClass: true}, BreakBeforeBraces: Custom}" a.cpp
struct foo
{
};
```
i.e. should `SplitEmptyRecord: true` mean that `AllowShortRecordOnASingleLine` is effectively ignored? Just checking if I understand correctly.
https://github.com/llvm/llvm-project/pull/154580
More information about the cfe-commits
mailing list