Keep trailing annotations close to their argument.
Before: bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY( aaaaaaaaaaaa); After: bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(aaaaaaaaaaaa); llvm-svn: 186077
This commit is contained in:
parent
69278e9ac8
commit
40db06af64
|
@ -1020,6 +1020,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
||||||
if (Right.Type == TT_StartOfName || Right.is(tok::kw_operator)) {
|
if (Right.Type == TT_StartOfName || Right.is(tok::kw_operator)) {
|
||||||
if (Line.First->is(tok::kw_for) && Right.PartOfMultiVariableDeclStmt)
|
if (Line.First->is(tok::kw_for) && Right.PartOfMultiVariableDeclStmt)
|
||||||
return 3;
|
return 3;
|
||||||
|
if (Left.Type == TT_StartOfName)
|
||||||
|
return 20;
|
||||||
else if (Line.MightBeFunctionDecl && Right.BindingStrength == 1)
|
else if (Line.MightBeFunctionDecl && Right.BindingStrength == 1)
|
||||||
// FIXME: Clean up hack of using BindingStrength to find top-level names.
|
// FIXME: Clean up hack of using BindingStrength to find top-level names.
|
||||||
return Style.PenaltyReturnTypeOnItsOwnLine;
|
return Style.PenaltyReturnTypeOnItsOwnLine;
|
||||||
|
|
|
@ -2511,6 +2511,10 @@ TEST_F(FormatTest, BreaksFunctionDeclarationsWithTrailingTokens) {
|
||||||
"bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
"bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||||
" GUARDED_BY(aaaaaaaaaaaa);",
|
" GUARDED_BY(aaaaaaaaaaaa);",
|
||||||
getGoogleStyle());
|
getGoogleStyle());
|
||||||
|
verifyFormat(
|
||||||
|
"bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||||
|
" GUARDED_BY(aaaaaaaaaaaa);",
|
||||||
|
getGoogleStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, BreaksDesireably) {
|
TEST_F(FormatTest, BreaksDesireably) {
|
||||||
|
|
Loading…
Reference in New Issue