Page MenuHomePhabricator

[clang-format] Cannot disable array initializer bin packing
Needs ReviewPublic

Authored by JaredNeil on Oct 6 2017, 9:49 AM.

Details

Reviewers
djasper
Summary

Currently there is no way to disable bin-packing of long JavaScript or C++ array literals.
There are options for BinPackArguments and BinPackParameters, but no corresponding BinPackArrays option.
Instead, they automatically start bin-packing at 20 elements.
This seems like a strange decision and seems even more strange that there is no way to disable it.
I feel like this should either have it's own option, or should just always respect the BinPackArguments option, no matter how long the list.

Since the latter seems like an easier solution, I've just done that for now. If you think this would be better off with its own option, I'm happy to do that instead.

Diff Detail

Event Timeline

JaredNeil created this revision.Oct 6 2017, 9:49 AM
JaredNeil retitled this revision from [clang-format] Cannot Disable Array Initializer Bin Packing to [clang-format] Cannot disable array initializer bin packing.Oct 6 2017, 9:51 AM
mprobst edited reviewers, added: djasper; removed: mprobst.Nov 25 2017, 1:35 AM

This review needs unit tests

Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2019, 2:59 AM

IIRC this was done due to performance problems in large nested initializer lists. Can you verify this doesn't regress performance?

MyDeveloperDay edited projects, added Restricted Project; removed Restricted Project.Sep 25 2019, 1:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2019, 1:51 AM