================
@@ -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);
----------------
HazardyKnusperkeks wrote:
```suggestion
verifyFormat("/* comment before code */\n"
"int x;",
"/*comment before code */\n"
"int x;", Style);
```
Don't hide the line breaks.
https://github.com/llvm/llvm-project/pull/162105
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits