diff options
author | Gedare Bloom <gedare@rtems.org> | 2025-02-07 23:10:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-07 22:10:35 -0800 |
commit | e0a21e23a7aa6acf3e07b866c3c599db5eb4b67f (patch) | |
tree | e692ea44452bf322e295173c53cb74ee7b45da1c /clang/lib/Format/Format.cpp | |
parent | de12bf508970ef9c0612c3950410530c4b822e6e (diff) | |
download | llvm-e0a21e23a7aa6acf3e07b866c3c599db5eb4b67f.zip llvm-e0a21e23a7aa6acf3e07b866c3c599db5eb4b67f.tar.gz llvm-e0a21e23a7aa6acf3e07b866c3c599db5eb4b67f.tar.bz2 |
[clang-format] Add BinPackLongBracedList style option (#112482)
The use of Cpp11BracedListStyle with BinPackArguments=False avoids bin
packing until reaching a hard-coded limit of 20 items. This is an
arbitrary choice. Introduce a new style option to allow disabling this
limit.
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 387daad..0898b69 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -995,6 +995,7 @@ template <> struct MappingTraits<FormatStyle> { Style.AlwaysBreakBeforeMultilineStrings); IO.mapOptional("AttributeMacros", Style.AttributeMacros); IO.mapOptional("BinPackArguments", Style.BinPackArguments); + IO.mapOptional("BinPackLongBracedList", Style.BinPackLongBracedList); IO.mapOptional("BinPackParameters", Style.BinPackParameters); IO.mapOptional("BitFieldColonSpacing", Style.BitFieldColonSpacing); IO.mapOptional("BracedInitializerIndentWidth", @@ -1507,6 +1508,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.AlwaysBreakBeforeMultilineStrings = false; LLVMStyle.AttributeMacros.push_back("__capability"); LLVMStyle.BinPackArguments = true; + LLVMStyle.BinPackLongBracedList = true; LLVMStyle.BinPackParameters = FormatStyle::BPPS_BinPack; LLVMStyle.BitFieldColonSpacing = FormatStyle::BFCS_Both; LLVMStyle.BracedInitializerIndentWidth = std::nullopt; |