[clang] [clang-format] fix aligning inheritance lists and binary operator operands with UT_AlignWithSpaces (PR #189218)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 31 11:47:49 PDT 2026
================
@@ -8435,6 +8435,20 @@ TEST_F(FormatTest, BreakConstructorInitializersAfterColon) {
" : public aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
" public bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb {};",
Style);
+ FormatStyle Tabbed = getLLVMStyleWithColumns(42);
+ Tabbed.IndentWidth = 4;
+ Tabbed.TabWidth = 4;
+ Tabbed.UseTab = FormatStyle::UT_AlignWithSpaces;
+ verifyFormat("class Foo : public aaaaaaaaa,\n"
+ " protected bbbbbbbbb,\n"
+ " private cccccccccc,\n"
+ " dddddddddd {};",
+ Tabbed);
+ verifyFormat("struct S {\n"
+ "\tclass Foo : public aaaaaaaaa,\n"
+ "\t private bbbbbbbbb {};\n"
+ "};",
+ Tabbed);
----------------
HazardyKnusperkeks wrote:
Why do you think it should not _can_ break after the colon? When the line would be too long it has to break, to try to obey the `ColumnLimit`.
https://github.com/llvm/llvm-project/pull/189218
More information about the cfe-commits
mailing list