diff options
author | Daniel Jasper <djasper@google.com> | 2013-05-06 06:35:44 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-05-06 06:35:44 +0000 |
commit | f022018698ced7e538b338d4f7befef9f81051ea (patch) | |
tree | 6edbb365c12d40bf0943960892e719a41feefe45 | |
parent | ce61715606b5f55ccc023720cdf9c1a796b0d526 (diff) |
Don't put a space before ellipsis.
Before: template <class ... Ts> void Foo(Ts ... ts) { Foo(ts ...); }
After: template <class... Ts> void Foo(Ts... ts) { Foo(ts...); }
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181182 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Format/TokenAnnotator.cpp | 2 | ||||
-rw-r--r-- | unittests/Format/FormatTest.cpp | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 185a45d43d..10ced9a7ee 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -1055,6 +1055,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, return false; if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) return false; + if (Right.is(tok::ellipsis)) + return false; return true; } diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 45c8e81dc7..ed1e6ed623 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -2602,6 +2602,11 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyGoogleFormat("A = new SomeType* [Length];"); } +TEST_F(FormatTest, UnderstandsEllipsis) { + verifyFormat("int printf(const char *fmt, ...);"); + verifyFormat("template <class... Ts> void Foo(Ts... ts) { Foo(ts...); }"); +} + TEST_F(FormatTest, AdaptivelyFormatsPointersAndReferences) { EXPECT_EQ("int *a;\n" "int *a;\n" |