================
@@ -332,6 +332,181 @@ TEST_F(FormatTestComments, UnderstandsSingleLineComments) 
{
   verifyNoCrash(StringRef("/*\\\0\n/", 6));
 }
 
+TEST_F(FormatTestComments, InsertsSpaceAfterOpeningBlockComment) {
+  FormatStyle Style = getLLVMStyle();
+  Style.SpaceInComments.AfterOpeningComment =
+      FormatStyle::CommentSpaceMode::Always;
+  Style.ReflowComments = FormatStyle::RCS_Never;
+
+  verifyFormat("foo(/* comment */);", "foo(/*comment */);", Style);
+  verifyFormat("foo(/* Logger=*/nullptr);", "foo(/*Logger=*/nullptr);", Style);
+  verifyFormat("/* comment */", "/*comment */", Style);
+  verifyFormat("/* comment before code */\nint x;",
+               "/*comment before code */\nint x;", Style);
+  verifyFormat("/* \ncomment */", "/*\ncomment */", Style);
+  verifyFormat("/* \ncomment */\nint x;", "/*\ncomment */\nint x;", Style);
+  verifyFormat("/* \ncomment line\n*/", "/*\ncomment line\n*/", Style);
+  verifyFormat("/* \n * comment star\n*/", "/*\n * comment star\n*/", Style);
+  verifyFormat("/* comment line\nnext */", "/*comment line\nnext */", Style);
+  EXPECT_EQ("/*\n*/", format("/*\n*/", Style));
----------------
HazardyKnusperkeks wrote:

That's one of the reasons why there is the three argument variant (you didn't 
count the `Style` argument). So yeah, exactly that.

https://github.com/llvm/llvm-project/pull/162105
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to