[PATCH] D91949: [clang-format] Add BeforeStructInitialization option in BraceWrapping configuration

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 23 01:54:23 PDT 2021


MyDeveloperDay added a comment.

A quick search of github shows over 1 billion hits to the word struct, in a variety of flavours, I'm just not convinced we want a separate option for each and every case,

Could we not look for a sequence of "tok::kw_struct,tok::identifier,tok::lbrace" or kw_strcut,tok::lbrace? rather than using the rather fragile Line->StartsWith which is only going to capture some of the cases.

  typedef struct  Foo{
     ..
  }
  
  static struct Foo {
     ..
  }
  
  static constexpr struct Foo {
     ..
  }
  
  template <> struct  Foo{
    ...
  }
  
  struct {
  }




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91949/new/

https://reviews.llvm.org/D91949



More information about the cfe-commits mailing list