diff options
| author | Daniel Jasper <djasper@google.com> | 2016-06-13 07:49:09 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2016-06-13 07:49:09 +0000 |
| commit | 594be2f03705f0beeefd6991045bbd2f793558a1 (patch) | |
| tree | c83843b90681e95c151acb7a6aecca9eb71dfc57 | |
| parent | 87448c55481fc37395fd23cb825463241d091752 (diff) | |
| download | bcm5719-llvm-594be2f03705f0beeefd6991045bbd2f793558a1.tar.gz bcm5719-llvm-594be2f03705f0beeefd6991045bbd2f793558a1.zip | |
clang-format: Fix incorrect cast detection.
Before:
auto s = sizeof...(Ts)-1;
After:
auto s = sizeof...(Ts) - 1;
llvm-svn: 272536
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 4 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 13bda71127f..1f1a32a2b2c 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -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; } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index d27da34d340..7e3b4ce3571 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -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) { |

