r181182 - Don't put a space before ellipsis.
Daniel Jasper
djasper at google.com
Sun May 5 23:35:45 PDT 2013
Author: djasper
Date: Mon May 6 01:35:44 2013
New Revision: 181182
URL: http://llvm.org/viewvc/llvm-project?rev=181182&view=rev
Log:
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...); }
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=181182&r1=181181&r2=181182&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon May 6 01:35:44 2013
@@ -1055,6 +1055,8 @@ bool TokenAnnotator::spaceRequiredBetwee
return false;
if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
return false;
+ if (Right.is(tok::ellipsis))
+ return false;
return true;
}
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=181182&r1=181181&r2=181182&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon May 6 01:35:44 2013
@@ -2602,6 +2602,11 @@ TEST_F(FormatTest, UnderstandsUsesOfStar
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"
More information about the cfe-commits
mailing list