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

2023-03-31 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added inline comments. Comment at: clang/docs/tools/dump_format_style.py:72 - subtype, napplied = re.subn(r'^std::vector<(.*)>$', r'\1', typestr) - if napplied == 1: -return 'List of ' + pluralize(to_yaml_type(subtype)) + match = re.match(r'std::vector<(.*)>$', ty

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

2023-03-31 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added a comment. I've implemented BracedInitializerIndentWidth now with significantly extended test coverage (including checking that it is not applied *too* broadly). The actual implementation is just as simple as that for `DesignatedInitializerIndentWidth`. > For the yaml stuff, I for

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

2023-03-31 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 updated this revision to Diff 509982. jp4a50 added a comment. Replace DesignatedInitializerIndentWidth with BracedInitializerIndentWidth which applies to a broader range of initializers. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146101/n

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

2023-03-30 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D146101#4233535 , @jp4a50 wrote: > Broadly speaking, these include aggregate initialization and list > initialization (possibly direct initialization with braces too). See the > initialization

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

2023-03-30 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment. In D146101#4233535 , @jp4a50 wrote: > So at the risk of adding to the number of decisions we need to come to a > consensus on, I was about to update the KJ style guide to explicitly call out > the difference in indent

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

2023-03-30 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added a comment. So at the risk of adding to the number of decisions we need to come to a consensus on, I was about to update the KJ style guide to explicitly call out the difference in indentation for designated initializers when I realized that we (both KJ code authors and clang-format

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

2023-03-30 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Style.D

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

2023-03-29 Thread Emilia Dreamer via Phabricator via cfe-commits
rymiel added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Style.Designate

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

2023-03-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Style.Designat

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

2023-03-29 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Style.Designate

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

2023-03-29 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Sty

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

2023-03-28 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Style.Designat

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

2023-03-28 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Style.Designate

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

2023-03-28 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Sty

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

2023-03-28 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth < 0 + ? Style.ContinuationIndentWidth + : Style.Designat

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

2023-03-27 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 marked an inline comment as done. jp4a50 added a comment. All actionable comments have been addressed. Comment at: clang/lib/Format/ContinuationIndenter.cpp:1665-1669 + const auto DesignatedInitializerIndentWidth = + Style.DesignatedInitializerIndentWidth <

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

2023-03-27 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 updated this revision to Diff 508740. jp4a50 added a comment. Address minor review comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146101/new/ https://reviews.llvm.org/D146101 Files: clang/docs/ClangFormatStyleOptions.rst clang/

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

2023-03-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/include/clang/Format/Format.h:2025 + /// on a new line. When set to -1 (default), ``ContinuationIndentWidth`` is + /// used. \code + /// AlignAfterOpenBracket: AlwaysBreak Comment at: clang

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

2023-03-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/include/clang/Format/Format.h:2037 + /// \endcode + int DesignatedInitializerIndentWidth; + owenpan wrote: > Please disregard my comment above. Comment at: clang/lib/Format/ContinuationIndente

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

2023-03-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D146101#4204653 , @jp4a50 wrote: >>> I think it's also worth noting that the google style guide gives an example >>> of designated initializers indented at 2 spaces (whereas their >>> "continuation indent" for wrapped functio

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

2023-03-22 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added a comment. In D146101#4208962 , @MyDeveloperDay wrote: > What I'd really like to see, is... in the event that > `ContinuationIndentWidth` is set and I do NOTset > `DesignatedInitializerIndentWidth` , then > `DesignatedInitializerIndentW

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

2023-03-21 Thread MyDeveloperDay via Phabricator via cfe-commits
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 Design

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

2023-03-19 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added a comment. > The style guide doesn't mention indenting designated initializers with 2 > spaces? That is a fair point. I will get it updated because the author and maintainer of that style guide is the one requesting this change since, in practice, codebases following this style gu

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

2023-03-19 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D146101#4201842 , @jp4a50 wrote: > I understand the added complexity and maintenance burden of a new option but > we do meet the 3 criteria listed in your link. > > - it is part of the KJ style guide which is used by the capn

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

2023-03-17 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added a comment. In D146101#4195293 , @owenpan wrote: > Please see > https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options. > Is there a way to fix the issue without adding a new option? @owenpan We could simpl

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

2023-03-15 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 marked 2 inline comments as done. jp4a50 added inline comments. Comment at: clang/lib/Format/Format.cpp:1372 LLVMStyle.DerivePointerAlignment = false; + LLVMStyle.DesignatedInitializerIndentWidth = 4; LLVMStyle.DisableFormat = false; jp4a50 wrote: >

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

2023-03-15 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 updated this revision to Diff 505540. jp4a50 added a comment. Change DesignatedInitializerIndentWidth to a signed integer which defaults to ContinuationIndentWidth when set to -1. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146101/new/ ht

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

2023-03-15 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added inline comments. Comment at: clang/lib/Format/Format.cpp:1372 LLVMStyle.DerivePointerAlignment = false; + LLVMStyle.DesignatedInitializerIndentWidth = 4; LLVMStyle.DisableFormat = false; MyDeveloperDay wrote: > so lets say someone is using an

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

2023-03-15 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/lib/Format/Format.cpp:1372 LLVMStyle.DerivePointerAlignment = false; + LLVMStyle.DesignatedInitializerIndentWidth = 4; LLVMStyle.DisableFormat = false; so lets say someone is using an IndentWidth of 2

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

2023-03-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Please see https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options. Is there a way to fix the issue without adding a new option? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146101/new/ h

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

2023-03-14 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay requested changes to this revision. MyDeveloperDay added inline comments. This revision now requires changes to proceed. Comment at: clang/include/clang/Format/Format.h:2031 + /// }; + /// } + unsigned DesignatedInitializerIndentWidth; End

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

2023-03-14 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added inline comments. Comment at: clang/docs/ClangFormatStyleOptions.rst:2704 + +**DesignatedInitializerIndentWidth** (``Unsigned``) + The number of columns to use to indent designated initializers that start on a new line. Perhaps it would be better to

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

2023-03-14 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 updated this revision to Diff 505302. jp4a50 added a comment. Apply clang-format. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146101/new/ https://reviews.llvm.org/D146101 Files: clang/docs/ClangFormatStyleOptions.rst clang/docs/Releas

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

2023-03-14 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 created this revision. Herald added a project: All. jp4a50 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. The option allows users to specify how many columns to use to indent designated initializers that start on a new line. Repos