Author: djasper Date: Mon Jun 13 02:49:09 2016 New Revision: 272536 URL: http://llvm.org/viewvc/llvm-project?rev=272536&view=rev Log: clang-format: Fix incorrect cast detection.
Before: auto s = sizeof...(Ts)-1; After: auto s = sizeof...(Ts) - 1; Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/unittests/Format/FormatTest.cpp Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=272536&r1=272535&r2=272536&view=diff ============================================================================== --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Jun 13 02:49:09 2016 @@ -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; } Modified: cfe/trunk/unittests/Format/FormatTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=272536&r1=272535&r2=272536&view=diff ============================================================================== --- cfe/trunk/unittests/Format/FormatTest.cpp (original) +++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Jun 13 02:49:09 2016 @@ -5494,6 +5494,7 @@ TEST_F(FormatTest, UnderstandsTemplatePa TEST_F(FormatTest, UnderstandsBinaryOperators) { verifyFormat("COMPARE(a, ==, b);"); + verifyFormat("auto s = sizeof...(Ts) - 1;"); } TEST_F(FormatTest, UnderstandsPointersToMembers) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits