================
@@ -14996,6 +14996,29 @@ TEST_F(FormatTest, SplitEmptyFunctionButNotRecord) {
Style);
}
+TEST_F(FormatTest, SplitShortFunction) {
+ FormatStyle Style = getLLVMStyleWithColumns(40);
+ Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None;
+ Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Always;
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.BraceWrapping.AfterFunction = true;
+
+ verifyFormat("int foo()\n"
+ "{ return 1; }",
+ Style);
+ verifyFormat("int foo()\n"
+ "{\n"
+ " // comment\n"
+ " return 1;\n"
+ "}",
+ Style);
+ verifyFormat("int foo()\n"
+ "{\n"
+ " return 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1;\n"
+ "}",
+ Style);
----------------
owenca wrote:
These test cases can pass with or without your patch, so they are probably
redundant as they should already be covered in the merging simple block tests.
If not, they should be added there in a separate patch.
https://github.com/llvm/llvm-project/pull/151428
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits