File tree Expand file tree Collapse file tree 2 files changed +22
-11
lines changed Expand file tree Collapse file tree 2 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -583,17 +583,15 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
583
583
return true ;
584
584
}
585
585
586
- // If the return type spans multiple lines, wrap before the function name.
587
- if (((Current.is (TT_FunctionDeclarationName) &&
588
- !State.Line ->ReturnTypeWrapped &&
589
- // Don't break before a C# function when no break after return type.
590
- (!Style.isCSharp () ||
591
- Style.AlwaysBreakAfterReturnType != FormatStyle::RTBS_None) &&
592
- // Don't always break between a JavaScript `function` and the function
593
- // name.
594
- !Style.isJavaScript ()) ||
595
- (Current.is (tok::kw_operator) && Previous.isNot (tok::coloncolon))) &&
596
- Previous.isNot (tok::kw_template) && CurrentState.BreakBeforeParameter ) {
586
+ if (Current.is (TT_FunctionDeclarationName) &&
587
+ !State.Line ->ReturnTypeWrapped &&
588
+ // Don't break before a C# function when no break after return type.
589
+ (!Style.isCSharp () ||
590
+ Style.AlwaysBreakAfterReturnType != FormatStyle::RTBS_None) &&
591
+ // Don't always break between a JavaScript `function` and the function
592
+ // name.
593
+ !Style.isJavaScript () && Previous.isNot (tok::kw_template) &&
594
+ CurrentState.BreakBeforeParameter ) {
597
595
return true ;
598
596
}
599
597
Original file line number Diff line number Diff line change @@ -26479,6 +26479,19 @@ TEST_F(FormatTest, BreakAfterAttributes) {
26479
26479
"{\n"
26480
26480
"}",
26481
26481
CtorDtorCode, Style);
26482
+
26483
+ verifyFormat("struct Foo {\n"
26484
+ " [[maybe_unused]]\n"
26485
+ " void operator+();\n"
26486
+ "};\n"
26487
+ "[[nodiscard]]\n"
26488
+ "Foo &operator-(Foo &);",
26489
+ Style);
26490
+
26491
+ Style.ReferenceAlignment = FormatStyle::ReferenceAlignmentStyle::RAS_Left;
26492
+ verifyFormat("[[nodiscard]]\n"
26493
+ "Foo& operator-(Foo&);",
26494
+ Style);
26482
26495
}
26483
26496
26484
26497
TEST_F(FormatTest, InsertNewlineAtEOF) {
You can’t perform that action at this time.
0 commit comments