@@ -389,9 +389,7 @@ TEST_F(FormatTest, RemovesEmptyLines) {
389389
390390 FormatStyle Style = getLLVMStyle();
391391 Style.AllowShortFunctionsOnASingleLine =
392- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
393- /*Inline=*/true,
394- /*Other=*/true});
392+ FormatStyle::ShortFunctionStyle::setAll();
395393 Style.MaxEmptyLinesToKeep = 2;
396394 Style.BreakBeforeBraces = FormatStyle::BS_Custom;
397395 Style.BraceWrapping.AfterClass = true;
@@ -3381,9 +3379,7 @@ TEST_F(FormatTest, MultiLineControlStatements) {
33813379 Style.BraceWrapping.AfterStruct = false;
33823380 Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_MultiLine;
33833381 Style.AllowShortFunctionsOnASingleLine =
3384- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
3385- /*Inline=*/true,
3386- /*Other=*/true});
3382+ FormatStyle::ShortFunctionStyle::setAll();
33873383 Style.ColumnLimit = 80;
33883384 verifyFormat("void shortfunction() { bar(); }", Style);
33893385 verifyFormat("struct T shortfunction() { return bar(); }", Style);
@@ -3405,9 +3401,7 @@ TEST_F(FormatTest, MultiLineControlStatements) {
34053401 Style.BraceWrapping.AfterFunction = false;
34063402 Style.BraceWrapping.AfterStruct = true;
34073403 Style.AllowShortFunctionsOnASingleLine =
3408- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
3409- /*Inline=*/true,
3410- /*Other=*/true});
3404+ FormatStyle::ShortFunctionStyle::setAll();
34113405 verifyFormat("void shortfunction() { bar(); }", Style);
34123406 verifyFormat("struct T shortfunction() { return bar(); }", Style);
34133407 verifyFormat("struct T\n"
@@ -4210,9 +4204,7 @@ TEST_F(FormatTest, FormatsNamespaces) {
42104204 FormatStyle ShortInlineFunctions = getLLVMStyle();
42114205 ShortInlineFunctions.NamespaceIndentation = FormatStyle::NI_All;
42124206 ShortInlineFunctions.AllowShortFunctionsOnASingleLine =
4213- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
4214- /*Inline=*/true,
4215- /*Other=*/false});
4207+ FormatStyle::ShortFunctionStyle::setEmptyAndInline();
42164208 verifyFormat("namespace {\n"
42174209 " void f() {\n"
42184210 " return;\n"
@@ -8349,9 +8341,7 @@ TEST_F(FormatTest, BreakConstructorInitializersAfterColon) {
83498341
83508342 Style.ColumnLimit = 80;
83518343 Style.AllowShortFunctionsOnASingleLine =
8352- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
8353- /*Inline=*/true,
8354- /*Other=*/true});
8344+ FormatStyle::ShortFunctionStyle::setAll();
83558345 Style.ConstructorInitializerIndentWidth = 2;
83568346 verifyFormat("SomeClass::Constructor() : a(a), b(b), c(c) {}", Style);
83578347 verifyFormat("SomeClass::Constructor() :\n"
@@ -15007,9 +14997,7 @@ TEST_F(FormatTest, PullTrivialFunctionDefinitionsIntoSingleLine) {
1500714997TEST_F(FormatTest, PullEmptyFunctionDefinitionsIntoSingleLine) {
1500814998 FormatStyle MergeEmptyOnly = getLLVMStyle();
1500914999 MergeEmptyOnly.AllowShortFunctionsOnASingleLine =
15010- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15011- /*Inline=*/false,
15012- /*Other=*/false});
15000+ FormatStyle::ShortFunctionStyle::setEmptyOnly();
1501315001 verifyFormat("class C {\n"
1501415002 " int f() {}\n"
1501515003 "};",
@@ -15039,9 +15027,7 @@ TEST_F(FormatTest, PullEmptyFunctionDefinitionsIntoSingleLine) {
1503915027TEST_F(FormatTest, PullInlineFunctionDefinitionsIntoSingleLine) {
1504015028 FormatStyle MergeInlineOnly = getLLVMStyle();
1504115029 MergeInlineOnly.AllowShortFunctionsOnASingleLine =
15042- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15043- /*Inline=*/true,
15044- /*Other=*/false});
15030+ FormatStyle::ShortFunctionStyle::setEmptyAndInline();
1504515031 verifyFormat("class C {\n"
1504615032 " int f() { return 42; }\n"
1504715033 "};",
@@ -15146,9 +15132,7 @@ TEST_F(FormatTest, PullInlineFunctionDefinitionsIntoSingleLine) {
1514615132TEST_F(FormatTest, CustomShortFunctionOptions) {
1514715133 FormatStyle CustomEmpty = getLLVMStyle();
1514815134 CustomEmpty.AllowShortFunctionsOnASingleLine =
15149- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15150- /*Inline=*/false,
15151- /*Other=*/false});
15135+ FormatStyle::ShortFunctionStyle::setEmptyOnly();
1515215136
1515315137 // Empty functions should be on a single line
1515415138 verifyFormat("int f() {}", CustomEmpty);
@@ -15185,9 +15169,7 @@ TEST_F(FormatTest, CustomShortFunctionOptions) {
1518515169 // Test with Inline = true, All = false
1518615170 FormatStyle CustomInline = getLLVMStyle();
1518715171 CustomInline.AllowShortFunctionsOnASingleLine =
15188- FormatStyle::ShortFunctionStyle({/*Empty=*/false,
15189- /*Inline=*/true,
15190- /*Other=*/false});
15172+ FormatStyle::ShortFunctionStyle::setInlineOnly();
1519115173
1519215174 verifyFormat("class C {\n"
1519315175 " int f() {}\n"
@@ -15212,9 +15194,7 @@ TEST_F(FormatTest, CustomShortFunctionOptions) {
1521215194 // Test with All = true
1521315195 FormatStyle CustomAll = getLLVMStyle();
1521415196 CustomAll.AllowShortFunctionsOnASingleLine =
15215- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15216- /*Inline=*/true,
15217- /*Other=*/true});
15197+ FormatStyle::ShortFunctionStyle::setAll();
1521815198
1521915199 // All functions should be on a single line if they fit
1522015200 verifyFormat("int f() { return 42; }", CustomAll);
@@ -15233,9 +15213,7 @@ TEST_F(FormatTest, CustomShortFunctionOptions) {
1523315213 // Test various combinations
1523415214 FormatStyle CustomMixed = getLLVMStyle();
1523515215 CustomMixed.AllowShortFunctionsOnASingleLine =
15236- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15237- /*Inline=*/true,
15238- /*Other=*/false});
15216+ FormatStyle::ShortFunctionStyle::setEmptyAndInline();
1523915217
1524015218 // Empty functions should be on a single line
1524115219 verifyFormat("int f() {}", CustomMixed);
@@ -15260,9 +15238,7 @@ TEST_F(FormatTest, CustomShortFunctionOptions) {
1526015238TEST_F(FormatTest, PullInlineOnlyFunctionDefinitionsIntoSingleLine) {
1526115239 FormatStyle MergeInlineOnly = getLLVMStyle();
1526215240 MergeInlineOnly.AllowShortFunctionsOnASingleLine =
15263- FormatStyle::ShortFunctionStyle({/*Empty=*/false,
15264- /*Inline=*/true,
15265- /*Other=*/false});
15241+ FormatStyle::ShortFunctionStyle::setInlineOnly();
1526615242 verifyFormat("class C {\n"
1526715243 " int f() { return 42; }\n"
1526815244 "};",
@@ -15334,9 +15310,7 @@ TEST_F(FormatTest, SplitEmptyFunction) {
1533415310 Style);
1533515311
1533615312 Style.AllowShortFunctionsOnASingleLine =
15337- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15338- /*Inline=*/false,
15339- /*Other=*/false});
15313+ FormatStyle::ShortFunctionStyle::setEmptyOnly();
1534015314 verifyFormat("int f() {}", Style);
1534115315 verifyFormat("int aaaaaaaaaaaaaa(int bbbbbbbbbbbbbb)\n"
1534215316 "{}",
@@ -15348,9 +15322,7 @@ TEST_F(FormatTest, SplitEmptyFunction) {
1534815322 Style);
1534915323
1535015324 Style.AllowShortFunctionsOnASingleLine =
15351- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15352- /*Inline=*/true,
15353- /*Other=*/false});
15325+ FormatStyle::ShortFunctionStyle::setEmptyAndInline();
1535415326 verifyFormat("class Foo {\n"
1535515327 " int f() {}\n"
1535615328 "};",
@@ -15359,6 +15331,10 @@ TEST_F(FormatTest, SplitEmptyFunction) {
1535915331 " int f() { return 0; }\n"
1536015332 "};",
1536115333 Style);
15334+ verifyFormat("class Foo {\n"
15335+ " int f() { return 0; }\n"
15336+ "};",
15337+ Style);
1536215338 verifyFormat("class Foo {\n"
1536315339 " int aaaaaaaaaaaaaa(int bbbbbbbbbbbbbb)\n"
1536415340 " {}\n"
@@ -15373,9 +15349,7 @@ TEST_F(FormatTest, SplitEmptyFunction) {
1537315349 Style);
1537415350
1537515351 Style.AllowShortFunctionsOnASingleLine =
15376- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15377- /*Inline=*/true,
15378- /*Other=*/true});
15352+ FormatStyle::ShortFunctionStyle::setAll();
1537915353 verifyFormat("int f() {}", Style);
1538015354 verifyFormat("int f() { return 0; }", Style);
1538115355 verifyFormat("int aaaaaaaaaaaaaa(int bbbbbbbbbbbbbb)\n"
@@ -15421,9 +15395,7 @@ TEST_F(FormatTest, SplitEmptyFunctionButNotRecord) {
1542115395TEST_F(FormatTest, KeepShortFunctionAfterPPElse) {
1542215396 FormatStyle Style = getLLVMStyle();
1542315397 Style.AllowShortFunctionsOnASingleLine =
15424- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
15425- /*Inline=*/true,
15426- /*Other=*/true});
15398+ FormatStyle::ShortFunctionStyle::setAll();
1542715399 verifyFormat("#ifdef A\n"
1542815400 "int f() {}\n"
1542915401 "#else\n"
@@ -21546,9 +21518,7 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) {
2154621518
2154721519 // Make a few changes to the style for testing purposes
2154821520 WhitesmithsBraceStyle.AllowShortFunctionsOnASingleLine =
21549- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
21550- /*Inline=*/false,
21551- /*Other=*/false});
21521+ FormatStyle::ShortFunctionStyle::setEmptyOnly();
2155221522 WhitesmithsBraceStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_None;
2155321523
2155421524 // FIXME: this test case can't decide whether there should be a blank line
@@ -23105,9 +23075,7 @@ TEST_F(FormatTest, BreakConstructorInitializersBeforeComma) {
2310523075
2310623076 Style.ColumnLimit = 80;
2310723077 Style.AllowShortFunctionsOnASingleLine =
23108- FormatStyle::ShortFunctionStyle({/*Empty=*/true,
23109- /*Inline=*/true,
23110- /*Other=*/true});
23078+ FormatStyle::ShortFunctionStyle::setAll();
2311123079 Style.ConstructorInitializerIndentWidth = 2;
2311223080 verifyFormat("SomeClass::Constructor()\n"
2311323081 " : a(a)\n"
0 commit comments