r184894 - Formatter: Don't put a space after parameter-naming block comments.
Alexander Kornienko
alexfh at google.com
Fri Jun 28 05:37:07 PDT 2013
On Fri, Jun 28, 2013 at 2:29 PM, Alexander Kornienko <alexfh at google.com>wrote:
> What is the reason for this? I've not found any related rules in the
> coding styles we support (llvm, google, chromium, linux kernel).
>
>
> On Wed, Jun 26, 2013 at 2:15 AM, Nico Weber <nicolasweber at gmx.de> wrote:
>
>> Author: nico
>> Date: Tue Jun 25 19:15:19 2013
>> New Revision: 184894
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=184894&view=rev
>> Log:
>> Formatter: Don't put a space after parameter-naming block comments.
>>
>> Before: f(a, b, /*doFoo=*/ false);
>> Now: f(a, b, /*doFoo=*/false);
>>
>> This style is a lot more common:
>> $ ack -H '=\*\/\w' lib | wc -l
>> 1281
>> $ ack -H '=\*\/ \w' lib | wc -l
>> 70
>>
>
Clarification: I see your research, but I'm personally not convinced that
this is a better style, and that it's worth special casing it.
>
>>
>> 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=184894&r1=184893&r2=184894&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
>> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Jun 25 19:15:19 2013
>> @@ -1110,6 +1110,8 @@ bool TokenAnnotator::spaceRequiredBetwee
>> return false;
>> if (Left.is(tok::period) || Right.is(tok::period))
>> return false;
>> + if (Left.Type == TT_BlockComment && Left.TokenText.endswith("=*/"))
>> + 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=184894&r1=184893&r2=184894&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
>> +++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Jun 25 19:15:19 2013
>> @@ -756,7 +756,7 @@ TEST_F(FormatTest, RemovesTrailingWhites
>> }
>>
>> TEST_F(FormatTest, UnderstandsBlockComments) {
>> - verifyFormat("f(/*test=*/ true);");
>> + verifyFormat("f(/*noSpaceAfterParameterNamingComment=*/true);");
>> EXPECT_EQ(
>> "f(aaaaaaaaaaaaaaaaaaaaaaaaa, /* Trailing comment for aa... */\n"
>> " bbbbbbbbbbbbbbbbbbbbbbbbb);",
>>
>>
>> _______________________________________________
>> 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/20130628/fe628e4e/attachment.html>
More information about the cfe-commits
mailing list