[clang] [clang-format] Add option AllowShortRecordOnASingleLine (PR #154580)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 27 00:09:56 PDT 2025
=?utf-8?q?Tomáš?= Slanina <itzexpoexpo at gmail.com>,
=?utf-8?q?Tomáš?= Slanina <itzexpoexpo at gmail.com>,
=?utf-8?q?Tomáš?= Slanina <itzexpoexpo at gmail.com>,
=?utf-8?q?Tomáš?= Slanina <itzexpoexpo at gmail.com>,
=?utf-8?q?Tomáš?= Slanina <itzexpoexpo at gmail.com>,
=?utf-8?q?Tomáš?= Slanina <itzexpoexpo at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/154580 at github.com>
================
@@ -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;
----------------
owenca wrote:
> We would expect:
>
> ```c++
> class foo
> {};
>
> class bar
> {
> int i;
> };
Isn't that exactly what we would get?
```
$ cat .clang-format
BasedOnStyle: LLVM
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
SplitEmptyRecord: false
$ cat a.cc
class foo {};
class bar {
int i;
};
$ clang-format -version
clang-format version 20.1.8
$ clang-format a.cc
class foo
{};
class bar
{
int i;
};
```
https://github.com/llvm/llvm-project/pull/154580
More information about the cfe-commits
mailing list