[clang] [clang-format] Add BreakAfterOpenBracket* and BreakBeforeCloseBracket* (PR #108332)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 28 12:30:46 PDT 2025


================
@@ -203,19 +203,6 @@ template <> struct MappingTraits<FormatStyle::BraceWrappingFlags> {
   }
 };
 
-template <> struct ScalarEnumerationTraits<FormatStyle::BracketAlignmentStyle> {
----------------
HazardyKnusperkeks wrote:

Basically
``` c++
if (IO.outputting()) {
  IO.mapOptional("AlignAfterOpenBracket", Style.AlignAfterOpenBracket); //Because it's a bool, this just becomes true or false;
} else {
  BracketAlignmentStyle local = /*default value*/;
  IO.mapOptional("AlignAfterOpenBracket", local);
  switch ( local ) {
    //map to Style.AlignAfterOpenBracket, Style.BreakAfterOpenBracketBracedList, etc.
  }
}
```

And because `BreakAfterOpenBracketBracedList` etc are handled afterwards they overwrite what may have been set in the `switch`.

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


More information about the cfe-commits mailing list