=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>,
=?utf-8?q?Tomáš?= Slanina <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -928,9 +954,15 @@ class LineJoiner {
return 0;
Limit -= 2;
unsigned MergedLines = 0;
- if (Style.AllowShortBlocksOnASingleLine != FormatStyle::SBS_Never ||
- (I[1]->First == I[1]->Last && I + 2 != E &&
- I[2]->First->is(tok::r_brace))) {
+
+ const bool TryMergeBlock =
+ Style.AllowShortBlocksOnASingleLine != FormatStyle::SBS_Never;
+ const bool TryMergeRecord =
+ Style.AllowShortRecordOnASingleLine == FormatStyle::SRS_Always;
+ const bool NextIsEmptyBlock = I[1]->First == I[1]->Last && I + 2 != E &&
+ I[2]->First->is(tok::r_brace);
+
+ if (TryMergeBlock || TryMergeRecord || NextIsEmptyBlock) {
----------------
owenca wrote:
```suggestion
auto TryMergeBlock = [&] {
if (Style.AllowShortBlocksOnASingleLine != FormatStyle::SBS_Never ||
Style.AllowShortRecordOnASingleLine == FormatStyle::SRS_Always) {
return true;
}
return I[1]->First == I[1]->Last && I + 2 != E &&
I[2]->First->is(tok::r_brace);
};
if (TryMergeBlock()) {
```
https://github.com/llvm/llvm-project/pull/154580
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits