diff options
-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" |