clang-format: Fix incorrect cast detection.

Before:
  auto s = sizeof...(Ts)-1;

After:
  auto s = sizeof...(Ts) - 1;

llvm-svn: 272536
This commit is contained in:
Daniel Jasper 2016-06-13 07:49:09 +00:00
parent 87448c5548
commit 594be2f037
2 changed files with 3 additions and 2 deletions

View File

@ -1140,7 +1140,7 @@ private:
FormatToken *LeftOfParens = Tok.MatchingParen->getPreviousNonComment();
if (LeftOfParens) {
// If there is an opening parenthesis left of the current parentheses,
// If there is a closing parenthesis left of the current parentheses,
// look past it as these might be chained casts.
if (LeftOfParens->is(tok::r_paren)) {
if (!LeftOfParens->MatchingParen ||
@ -1159,7 +1159,7 @@ private:
// Certain other tokens right before the parentheses are also signals that
// this cannot be a cast.
if (LeftOfParens->isOneOf(tok::at, tok::r_square, TT_OverloadedOperator,
TT_TemplateCloser))
TT_TemplateCloser, tok::ellipsis))
return false;
}

View File

@ -5494,6 +5494,7 @@ TEST_F(FormatTest, UnderstandsTemplateParameters) {
TEST_F(FormatTest, UnderstandsBinaryOperators) {
verifyFormat("COMPARE(a, ==, b);");
verifyFormat("auto s = sizeof...(Ts) - 1;");
}
TEST_F(FormatTest, UnderstandsPointersToMembers) {