[clang] [clang-format] allow short function body on a single line (PR #151428)

Lidong Yan via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 3 08:31:58 PDT 2025


================
@@ -1921,6 +1921,10 @@ void UnwrappedLineParser::parseStructuralElement(
           }
         } else if (Style.BraceWrapping.AfterFunction) {
           addUnwrappedLine();
+        } else if (Style.AllowShortFunctionBodiesOnASingleLine) {
+          // Wrap the left brace here; we'll try to merge it back
----------------
brandb97 wrote:

The reason I parse the { in void foo() { as an unwrapped line is to allow merging the { and the function body into one line when the function body is very short.

https://github.com/llvm/llvm-project/pull/151428


More information about the cfe-commits mailing list