forked from OSchip/llvm-project
clang-format: Allow splitting the line after /**/-comments.
While it might change the meaning of the comment in rare circumstances, it is better than violating the column limit. llvm-svn: 270975
This commit is contained in:
parent
5fa681ee78
commit
99302edd1c
|
@ -1826,6 +1826,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
||||||
return 500;
|
return 500;
|
||||||
if (Left.isOneOf(tok::kw_class, tok::kw_struct))
|
if (Left.isOneOf(tok::kw_class, tok::kw_struct))
|
||||||
return 5000;
|
return 5000;
|
||||||
|
if (Left.is(tok::comment))
|
||||||
|
return 1000;
|
||||||
|
|
||||||
if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon))
|
if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon))
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -2464,7 +2466,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
|
||||||
Left.getPrecedence() == prec::Assignment))
|
Left.getPrecedence() == prec::Assignment))
|
||||||
return true;
|
return true;
|
||||||
return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
|
return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
|
||||||
tok::kw_class, tok::kw_struct) ||
|
tok::kw_class, tok::kw_struct, tok::comment) ||
|
||||||
Right.isMemberAccess() ||
|
Right.isMemberAccess() ||
|
||||||
Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless,
|
Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless,
|
||||||
tok::colon, tok::l_square, tok::at) ||
|
tok::colon, tok::l_square, tok::at) ||
|
||||||
|
|
|
@ -1143,6 +1143,8 @@ TEST_F(FormatTest, UnderstandsBlockComments) {
|
||||||
" aaaaaaaaaaaaaaaaaa ,\n"
|
" aaaaaaaaaaaaaaaaaa ,\n"
|
||||||
" aaaaaaaaaaaaaaaaaa) { /*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa*/\n"
|
" aaaaaaaaaaaaaaaaaa) { /*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa*/\n"
|
||||||
"}"));
|
"}"));
|
||||||
|
verifyFormat("f(/* aaaaaaaaaaaaaaaaaa = */\n"
|
||||||
|
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
|
||||||
|
|
||||||
FormatStyle NoBinPacking = getLLVMStyle();
|
FormatStyle NoBinPacking = getLLVMStyle();
|
||||||
NoBinPacking.BinPackParameters = false;
|
NoBinPacking.BinPackParameters = false;
|
||||||
|
|
Loading…
Reference in New Issue