r181182 - Don't put a space before ellipsis.

Daniel Jasper djasper at google.com
Sun May 5 23:56:05 PDT 2013


Interesting. I had a brief look at the LLVM codebase, and I found 43 cases
of "class ..." and 145 cases of "class... ".


On Mon, May 6, 2013 at 8:45 AM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Sun, May 5, 2013 at 11:35 PM, Daniel Jasper <djasper at google.com> wrote:
>
>> 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...); }
>>
>
> I would think the star-on-the-right crowd (that is, the people who are
> right ;)) would actually want:
>
> template <class ...Ts> void Foo(Ts ...ts) { Foo(ts...); }
>
> ... since the ellipsis, just like an & or *, binds to the thing on its
> right.
>
>
>> 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"
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130506/dd700479/attachment.html>


More information about the cfe-commits mailing list