r184894 - Formatter: Don't put a space after parameter-naming block comments.

Reid Kleckner rnk at google.com
Fri Jun 28 08:47:45 PDT 2013


Thanks, this had been bugging me.  I prefer the /*foo=*/bar style which is
more common.


On Tue, Jun 25, 2013 at 5:15 PM, 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
>
>
> 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/a000af3b/attachment.html>


More information about the cfe-commits mailing list