Add a new option PackConstructorInitializers and deprecate the related options ConstructorInitializerAllOnOneLineOrOnePerLine and AllowAllConstructorInitializersOnNextLine. Below is the mapping:
PackConstructorInitializers ConstructorInitializer... AllowAll...
Never - -
BinPack false -
CurrentLine true false
NextLine true trueThe option value Never fixes PR50549 by always placing each constructor initializer on its own line. Please see D105099 for previous discussions.
Also need to handle the default value PCIS_NextLine for Google and Chromium styles:
StringRef BasedOn; IO.mapOptional("BasedOnStyle", BasedOn); const bool IsGoogleOrChromium = BasedOn.equals_insensitive("google") || BasedOn.equals_insensitive("chromium"); bool OnCurrentLine = IsGoogleOrChromium; bool OnNextLine = IsGoogleOrChromium; IO.mapOptional("ConstructorInitializerAllOnOneLineOrOnePerLine", OnCurrentLine); IO.mapOptional("AllowAllConstructorInitializersOnNextLine", OnNextLine); if (IsGoogleOrChromium && Style.PackConstructorInitializers == FormatStyle::PCIS_NextLine) { if (!OnCurrentLine) Style.PackConstructorInitializers = FormatStyle::PCIS_BinPack; else if (!OnNextLine) Style.PackConstructorInitializers = FormatStyle::PCIS_CurrentLine; } else if (Style.PackConstructorInitializers == FormatStyle::PCIS_BinPack && OnCurrentLine) { Style.PackConstructorInitializers = OnNextLine ? FormatStyle::PCIS_NextLine : FormatStyle::PCIS_CurrentLine; }