From 861576b8019392f15c803ac14a4bc31fbd93aab2 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 26 Jun 2013 00:15:19 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184894 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/TokenAnnotator.cpp | 2 ++ unittests/Format/FormatTest.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index c5315e7260..681903b412 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -1110,6 +1110,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, 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; } diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 6b1d2d3f40..909932e7c4 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -756,7 +756,7 @@ TEST_F(FormatTest, RemovesTrailingWhitespaceOfComments) { } TEST_F(FormatTest, UnderstandsBlockComments) { - verifyFormat("f(/*test=*/ true);"); + verifyFormat("f(/*noSpaceAfterParameterNamingComment=*/true);"); EXPECT_EQ( "f(aaaaaaaaaaaaaaaaaaaaaaaaa, /* Trailing comment for aa... */\n" " bbbbbbbbbbbbbbbbbbbbbbbbb);", -- 2.40.0