forked from OSchip/llvm-project
clang-format: Avoid bad line break.
Before: int aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(const typename aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa); After: int aaaaaaaaaaaaaaaaaaaaaaaaaaaaa( const typename aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa); llvm-svn: 215442
This commit is contained in:
parent
9ea5582816
commit
598dd330e8
|
@ -1813,14 +1813,15 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
|
|||
return true;
|
||||
if (Left.Type == TT_ArrayInitializerLSquare)
|
||||
return true;
|
||||
if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const))
|
||||
return true;
|
||||
return (Left.isBinaryOperator() &&
|
||||
!Left.isOneOf(tok::arrowstar, tok::lessless) &&
|
||||
!Style.BreakBeforeBinaryOperators) ||
|
||||
Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
|
||||
tok::kw_class, tok::kw_struct) ||
|
||||
Right.isMemberAccess() ||
|
||||
Right.isOneOf(tok::lessless, tok::colon, tok::l_square, tok::at,
|
||||
tok::kw_typename) ||
|
||||
Right.isOneOf(tok::lessless, tok::colon, tok::l_square, tok::at) ||
|
||||
(Left.is(tok::r_paren) &&
|
||||
Right.isOneOf(tok::identifier, tok::kw_const)) ||
|
||||
(Left.is(tok::l_paren) && !Right.is(tok::r_paren));
|
||||
|
|
|
@ -4493,6 +4493,8 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) {
|
|||
" B>*>(\n"
|
||||
"\n"
|
||||
" );"));
|
||||
verifyFormat("int aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
|
||||
" const typename aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa);");
|
||||
|
||||
FormatStyle AlwaysBreak = getLLVMStyle();
|
||||
AlwaysBreak.AlwaysBreakTemplateDeclarations = true;
|
||||
|
|
Loading…
Reference in New Issue