[clang] [clang-format] Add option AllowShortRecordOnASingleLine (PR #154580)
Tomáš Slanina via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 4 12:34:52 PST 2025
================
@@ -266,15 +267,22 @@ class LineJoiner {
}
}
+ // Try merging record blocks that have had their left brace wrapped into
+ // a single line.
+ if (NextLine.First->isOneOf(TT_ClassLBrace, TT_StructLBrace,
+ TT_UnionLBrace)) {
+ if (unsigned MergedLines = tryMergeRecord(I, E, Limit))
+ return MergedLines;
+ }
+
const auto *PreviousLine = I != AnnotatedLines.begin() ? I[-1] : nullptr;
- // Handle empty record blocks where the brace has already been wrapped.
+
+ // Handle blocks where the brace has already been wrapped.
----------------
itzexpoexpo wrote:
The code also handles non-empty record blocks and namespaces. The wording "Handle empty record blocks" wasn't accurate.
https://github.com/llvm/llvm-project/pull/154580
More information about the cfe-commits
mailing list