[clang] [clang-format]: Add `Custom` to `ShortFunctionStyle`; add new AllowShortFunctionsOnASingleLineOptions for granular setup (PR #134337)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 8 18:48:30 PDT 2025
================
@@ -1500,7 +1523,10 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
LLVMStyle.AllowShortCaseLabelsOnASingleLine = false;
LLVMStyle.AllowShortCompoundRequirementOnASingleLine = true;
LLVMStyle.AllowShortEnumsOnASingleLine = true;
- LLVMStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_All;
+ LLVMStyle.AllowShortFunctionsOnASingleLine =
+ FormatStyle::ShortFunctionStyle({/*Empty=*/true,
----------------
irymarchyk wrote:
Please let me know if it is acceptable to make static functions like `FormatStyle::ShortFunctionStyle::SFS_Empty()` (or similar) so we don't have specify each member in constructor every time. This might be useful in the future - I want to add few options to ShortFunctionStyle, and I have to increase number of parameters in constructor. This will require changes in every place where it was used.
https://github.com/llvm/llvm-project/pull/134337
More information about the cfe-commits
mailing list