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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 27 04:47:43 PDT 2021


MyDeveloperDay added a comment.

Are we happy with the way this behaves? I realise some of this needs semantic information but I think the fact it only handles 1 of these 4 cases leaves me feeling a little cold. (I just don't want to be having to defend this as to why it doesn't work in all cases.)

  ---
  Language: Cpp
  BasedOnStyle: LLVM
  BreakBeforeBraces: Custom
  BraceWrapping:
      BeforeClassStructInit: true



  struct S2 {
    int x, y;
  };
  
  void foo() {
    struct S2 a1 =
        {1, 2};
    struct S2 a2[3] = {{1, 2}, {3, 4}, 5, 6};
  
    S2 a3 = {1, 2};
    S2 a4[3] = {{1, 2}, {3, 4}, 5, 6};
  }
  
  int main(int argc, char **argv) { return 0; }


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

https://reviews.llvm.org/D91949



More information about the cfe-commits mailing list