[PATCH] D146101: [clang-format] Add DesignatedInitializerIndentWidth option.

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 02:33:02 PDT 2023


MyDeveloperDay added a comment.

What I'd really like to see, is... in the event that `IndentWidth` is set and I do NOTset `DesignatedInitializerIndentWidth`   , then `DesignatedInitializerIndentWidth`  would inherit from that (not the default as you have here),  if I set IndentWidth to 3 DesignatedInitializerIndentWidth should be 3

Otherwise if I set `DesignatedInitializerIndentWidth` explicitly then it can be what is set,

i.e. (for base LLVM style)

  IndentWidth is not set = (default) 4
  DesignatedInitializerIndentWidth = not set  (implicitly 4)
  
  IndentWidth is set = 3
  DesignatedInitializerIndentWidth = not set  (implicitly 3)
  
  IndentWidth is not set = (default) 4
  DesignatedInitializerIndentWidth = is set to 2  (explicitly 2)
  
  IndentWidth is set = 3
  DesignatedInitializerIndentWidth = is set to 4 (explicitly 4)



================
Comment at: clang/unittests/Format/FormatTest.cpp:4828
+               "    .yyyyyyyyyyyyyyyyyy = 2,\n"
+               "    .zzzzzzzzzzzzzzzzzz = 3};\n",
+               Style);
----------------
jp4a50 wrote:
> MyDeveloperDay wrote:
> > Can we fix the brace positioning too
> What would you expect the brace positioning to be here? I noticed that, with this configuration at least, the closing brace goes at the end of the same line (as the last initializer) when there is no trailing comma but goes on a new line if there is a trailing comma.
part of me would like an option to not have to supply the trailing comma, 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146101



More information about the cfe-commits mailing list