clang-format: Only special-case top-level */& in multivar-declstmts.

Before (even with PointerAlignment: Left):
  vector<int *> a, b;

After:
  vector<int*> a, b;

llvm-svn: 282410
This commit is contained in:
Daniel Jasper 2016-09-26 15:14:24 +00:00
parent 160572855d
commit 3f2cde91d8
2 changed files with 2 additions and 1 deletions

View File

@ -2015,7 +2015,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
Left.Previous->is(tok::r_paren)) ||
(!Left.isOneOf(TT_PointerOrReference, tok::l_paren) &&
(Style.PointerAlignment != FormatStyle::PAS_Left ||
Line.IsMultiVariableDeclStmt)));
(Line.IsMultiVariableDeclStmt && Left.NestingLevel == 0))));
if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) &&
(!Left.is(TT_PointerOrReference) ||
(Style.PointerAlignment != FormatStyle::PAS_Right &&

View File

@ -4802,6 +4802,7 @@ TEST_F(FormatTest, DeclarationsOfMultipleVariables) {
verifyFormat("aaaaaaaaa *a = aaaaaaaaaaaaaaaaaaa, *b = bbbbbbbbbbbbbbbbbbb,\n"
" *b = bbbbbbbbbbbbbbbbbbb, *d = ddddddddddddddddddd;",
Style);
verifyFormat("vector<int*> a, b;", Style);
}
TEST_F(FormatTest, ConditionalExpressionsInBrackets) {