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

Anastasiia Lukianenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 07:35:34 PST 2020


anastasiia_lukianenko added a comment.

AfterStruct setting doesn't affect struct initialization. Your presumption is right.
About these examples... I think that second and third variants are the right ones.

  struct new_struct struct_name = {
      a = 1
  };
  struct new_struct struct_name = { a = 1 };
  struct new_struct struct_name = 
  { 
      a = 1,
  };

There is a test which shows that first example is not expected in case without break after '='

  TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) {
    // Elaborate type variable declarations.
    verifyFormat("struct foo a = {bar};\nint n;");


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

https://reviews.llvm.org/D91949



More information about the cfe-commits mailing list