[clang] [clang-format]: Add `Custom` to `ShortFunctionStyle`; add new AllowShortFunctionsOnASingleLineOptions for granular setup (PR #134337)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 5 12:00:15 PDT 2025


================
@@ -1893,6 +1938,8 @@ FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language) {
   } else {
     ChromiumStyle.AllowAllParametersOfDeclarationOnNextLine = false;
     ChromiumStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+    ChromiumStyle.AllowShortFunctionsOnASingleLineOptions = {};
+    ChromiumStyle.AllowShortFunctionsOnASingleLineOptions.Inline = true;
----------------
owenca wrote:

```suggestion
    ChromiumStyle.AllowShortFunctionsOnASingleLineOptions.Empty = true;
     ChromiumStyle.AllowShortFunctionsOnASingleLineOptions.Inline = true;
    ChromiumStyle.AllowShortFunctionsOnASingleLineOptions.Other = false;
```
`SFS_Inline` requires setting both `Empty` and `Inline`.

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


More information about the cfe-commits mailing list