================
@@ -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);
----------------
brandb97 wrote:

Emm, I am actually making sure merge short function should be subject to column 
limit. But as you requested to remove, I would remove them.

https://github.com/llvm/llvm-project/pull/151428
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to