]> granicus.if.org Git - clang/commitdiff
Don't put a space before ellipsis.
authorDaniel Jasper <djasper@google.com>
Mon, 6 May 2013 06:35:44 +0000 (06:35 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 6 May 2013 06:35:44 +0000 (06:35 +0000)
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

lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp

index 185a45d43d14bb21d2fd4f2795c7a0209f331793..10ced9a7ee09a3095f4cb2225140ba536d486c2c 100644 (file)
@@ -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;
 }
 
index 45c8e81dc755abeb31a61ed94cf355a23026378d..ed1e6ed6231e77876e5b1a0b4efff2d48267f188 100644 (file)
@@ -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"