[PATCH] D91949: [clang-format] Add BeforeStructInitialization option in BraceWrapping configuration
    Anastasiia Lukianenko via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon Mar 22 04:12:47 PDT 2021
    
    
  
anastasiia_lukianenko added a comment.
In D91949#2503646 <https://reviews.llvm.org/D91949#2503646>, @MyDeveloperDay wrote:
> I think the revision whilst it does what is needed to structs doesn't address the many other times this forms appear. I think we need something a little more extensive. It can't just be when a line starts with struct
I did it in the same way as existing options made in MustBreakBefore function (here we can see that we check only //Line.startsWith(tok::kw_struct)//, no more extensive conditions):
  if (isAllmanBrace(Left) || isAllmanBrace(Right))
    return (Line.startsWith(tok::kw_enum) && Style.BraceWrapping.AfterEnum) ||
           (Line.startsWith(tok::kw_typedef, tok::kw_enum) &&
            Style.BraceWrapping.AfterEnum) ||
           (Line.startsWith(tok::kw_class) && Style.BraceWrapping.AfterClass) ||
           (Line.startsWith(tok::kw_struct) && Style.BraceWrapping.AfterStruct);
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91949/new/
https://reviews.llvm.org/D91949
    
    
More information about the cfe-commits
mailing list