This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Add BracedInitializerIndentWidth option.
ClosedPublic

Authored by jp4a50 on Mar 14 2023, 3:29 PM.

Details

Summary

The option allows users to specify how many columns to use to indent
the contents of initializer lists.

This addresses the corresponding github issue, albeit in a slightly different and broader way to what was proposed there.

Diff Detail

Event Timeline

jp4a50 created this revision.Mar 14 2023, 3:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2023, 3:29 PM
jp4a50 requested review of this revision.Mar 14 2023, 3:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2023, 3:29 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jp4a50 updated this revision to Diff 505302.Mar 14 2023, 3:33 PM

Apply clang-format.

jp4a50 edited the summary of this revision. (Show Details)Mar 14 2023, 3:35 PM
jp4a50 added reviewers: MyDeveloperDay, owenpan.
jp4a50 added a project: Restricted Project.
jp4a50 edited the summary of this revision. (Show Details)Mar 14 2023, 3:46 PM
jp4a50 added inline comments.
clang/docs/ClangFormatStyleOptions.rst
2739

Perhaps it would be better to make this a signed integer and default to -1 which would cause ContinuationIndentWidth to be used (i.e. current behaviour)?

MyDeveloperDay requested changes to this revision.Mar 14 2023, 4:20 PM
MyDeveloperDay added inline comments.
clang/include/clang/Format/Format.h
2064

Endcode

clang/lib/Format/Format.cpp
910

Needs a parse test

clang/unittests/Format/FormatTest.cpp
4861

Can we fix the brace positioning too

This revision now requires changes to proceed.Mar 14 2023, 4:20 PM
MyDeveloperDay added inline comments.Mar 15 2023, 3:30 AM
clang/lib/Format/Format.cpp
1379

so lets say someone is using an IndentWidth of 2 and now you introduce this as being 4 here as the default

Without them changing anything, all their DesignatedIntializer code will get refactored to a IndentWidth of 4 rather than the 2 it was previously

This is where we get called out for "changing the defaults", which really we are not we are just reclassifying how it behaves.

What we normally say here is can you point us to a public style that has an independent DesignatedIntializerIndentWidth which is independent from the levels of IndentWidth everywhere else.

Whilst I can see more knobs feels good, this will change code and we'll have to manage that expectation.

jp4a50 added inline comments.Mar 15 2023, 7:24 AM
clang/lib/Format/Format.cpp
1379

Yep, so as per my comment in clang/docs/ClangFormatStyleOptions.rst I think I am changing my mind about this anyway.

My motivation for making this change is to support the KJ style guide which is quoted in the github issue - I work on a team that uses the KJ style guide.

The KJ style guide wants a designated initializer indent width of 2 along with a "normal" indent width of 2, so there is no explicit need for us to have those two values be different.

When originally making these changes, I did think that having "more knobs" was a good idea, but I agree that this could lead to annoying behaviour for some users and they would probably expect the designated initializer indent to match either the normal indent or the continuation indent.

How about I change the option to an integer and, when it's -1 (the default), the designated initializer indent matches the continuation indent, but if it is set to a value >= 0 then that number of columns is used instead?

clang/unittests/Format/FormatTest.cpp
4861

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.

jp4a50 updated this revision to Diff 505540.Mar 15 2023, 9:54 AM

Change DesignatedInitializerIndentWidth to a signed integer which defaults to ContinuationIndentWidth when set to -1.

jp4a50 marked 2 inline comments as done.Mar 15 2023, 9:56 AM
jp4a50 added inline comments.
clang/lib/Format/Format.cpp
1379

I've reimplemented the option as a signed integer as per my suggestion above.

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 simply change the indentation level of designated initializers for everyone to match IndentWidth instead of ContinuationIndentWidth but I suspect that other users might be unhappy if we made that breaking change? I guess we could also consider making this behaviour only kick in when a specific set of *other* options are specified (e.g. AlwaysBreak) so that it applies to our clang-format style and not *all* others but that just feels like a hack.

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 proto project which has over 100 maintainers
  • the style guide is publicly accessible here
  • I'm willing to contribute and maintain patches :)

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 function parameters is 4).

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 proto project which has over 100 maintainers
  • the style guide is publicly accessible here

The style guide doesn't mention indenting designated initializers with 2 spaces?

  • I'm willing to contribute and maintain patches :)

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 function parameters is 4).

It's likely an error that the designated initializer example there shows 2-space indents as clang-format uses the 4-space continuation indent width:

clang-format -style=Google
Point p = {
    .x = 1.0, .y = 2.0,
    // z will be 0.0
};
Point p = {
    .x = 1.0, .y = 2.0,
    // z will be 0.0
};

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 guide indent designated initializers with 2 spaces.

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 function parameters is 4).

It's likely an error that the designated initializer example there shows 2-space indents as clang-format uses the 4-space continuation indent width:

This is possible, but isn't it also possible that they would prefer designated initializers to be indented at 2 spaces but don't have the option with clang-format currently?

The only general information supplied in the google style guide about indentation is as follows:

  • Default indentation is 2 spaces.
  • Wrapped parameters have a 4 space indent.

If we are taking a strict definition of parameters, the above suggests to me that designated initializers would fall under the default indentation of 2 spaces.

As mentioned on my other diff, I'm away until next Monday now so won't be able to get back to further comments til then.

MyDeveloperDay added a comment.EditedMar 21 2023, 2:32 AM

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

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

i.e. (for base LLVM style)

ContinuationIndentWidth is not set = (default) 4
DesignatedInitializerIndentWidth = not set  (implicitly 4)

ContinuationIndentWidth is set = 3
DesignatedInitializerIndentWidth = not set  (implicitly 3)

ContinuationIndentWidth is not set = (default) 4
DesignatedInitializerIndentWidth = is set to 2  (explicitly 2)

ContinuationIndentWidth is set = 3
DesignatedInitializerIndentWidth = is set to 4 (explicitly 4)
clang/unittests/Format/FormatTest.cpp
4861

part of me would like an option to not have to supply the trailing comma,

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

Agree that this makes the most sense and, luckily, that is exactly the behaviour I implemented in my most recent diff!

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 function parameters is 4).

It's likely an error that the designated initializer example there shows 2-space indents as clang-format uses the 4-space continuation indent width:

This is possible, but isn't it also possible that they would prefer designated initializers to be indented at 2 spaces but don't have the option with clang-format currently?

I really doubt it as the creators of clang-format and a number of reviewers/contributors/maintainers from the recent past were Google engineers, I believe.

The only general information supplied in the google style guide about indentation is as follows:

  • Default indentation is 2 spaces.
  • Wrapped parameters have a 4 space indent.

If we are taking a strict definition of parameters, the above suggests to me that designated initializers would fall under the default indentation of 2 spaces.

IMO it's clear that in Google style IndentWidth = 2 and ContinuationIndentWidth = 4. I think in general IndentWidth is for block indent and ContinuationIndentWidth is for everything else.

clang/lib/Format/ContinuationIndenter.cpp
1665

Can you also move it into the else if below to reduce the scope of the pointer? Please note the typo NextNoComment.

1670–1674

Using -1 to mean ContinuationIndentWidth is unnecessary and somewhat confusing IMO.

owenpan added inline comments.Mar 24 2023, 12:03 AM
clang/include/clang/Format/Format.h
2070
clang/lib/Format/Format.cpp
1379
clang/unittests/Format/ConfigParseTest.cpp
252–253

Delete.

clang/unittests/Format/FormatTest.cpp
4878

Delete it and rearrange the tests so that the unspecified (default) DesignatedInitializerIndentWidth is tested first.

owenpan added inline comments.Mar 24 2023, 2:17 AM
clang/include/clang/Format/Format.h
2070

Please disregard my comment above.

clang/lib/Format/ContinuationIndenter.cpp
1670–1674

Please disregard my comment above.

clang/lib/Format/Format.cpp
1379

Please disregard my comment above.

clang/unittests/Format/ConfigParseTest.cpp
252–253

Please disregard my comment above.

clang/unittests/Format/FormatTest.cpp
4878

Please disregard my comment above.

owenpan added inline comments.Mar 24 2023, 2:40 AM
clang/include/clang/Format/Format.h
2058
2070

Please add \version 17.

clang/lib/Format/ContinuationIndenter.cpp
1665

Please ignore my comment above.

jp4a50 updated this revision to Diff 508740.Mar 27 2023, 11:27 AM

Address minor review comments.

jp4a50 marked an inline comment as done.Mar 27 2023, 11:29 AM

All actionable comments have been addressed.

clang/lib/Format/ContinuationIndenter.cpp
1670–1674

Just to make sure we are on the same page, does this mean that you are happy with the approach of using -1 as a default value to indicate that ContinuationIndentWidth should be used?

I did initially consider using std::optional<unsigned> and using empty optional to indicate that ContinuationIndentWidth should be used but I saw that PPIndentWidth was using -1 to default to using IndentWidth so I followed that precedent.

clang/unittests/Format/FormatTest.cpp
4861

I agree that it's slightly odd behaviour but I think it's pretty orthogonal to this change and would deserve it's own diff.

I think it's also pretty debatable what the behaviour *should* be. Should the AlignAfterOpenBracket option dictate the formatting of braces like this? Oddly enough, specifying AlwaysBreak (as I have done in this test) does indeed result in breaking after the { but changing it to BlockIndent doesn't put the closing } on a newline. Should we instead add a new AlignAfterOpenBrace analogue of AlignAfterOpenBracket?

Would you like me to to raise a separate issue to track this (if it doesn't already exist)?

owenpan added inline comments.Mar 28 2023, 1:53 AM
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

Yep! I would prefer the optional, but as you pointed out, we already got PPIndentWidthusing -1.

clang/lib/Format/ContinuationIndenter.cpp
1670–1674

From the C++ side I totally agree. One could use value_or(), which would make the code much more readable.
And just because PPIndentWidth is using -1 is no reason to repeat that, we could just as easily change PPIndentWidht to an optional.

But how would it look in yaml?

jp4a50 added inline comments.Mar 28 2023, 1:58 PM
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

In YAML we wouldn't need to support empty optional being *explicitly* specified - it would just be the default.

So specifying DesignatedInitializerIndentWidth: 4 would set the std::optional<unsigned> to 4 but if DesignatedInitializerIndentWidth was omitted from the YAML then the optional would simply not be set during parsing.

Of course, if we were to change PPIndentWidth to work that way too, it would technically be a breaking change because users may have *explicitly* specified -1 in their YAML.

owenpan added inline comments.Mar 28 2023, 3:23 PM
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

And just because PPIndentWidth is using -1 is no reason to repeat that, we could just as easily change PPIndentWidht to an optional.

We would have to deal with backward compatibility to avoid regressions though.

clang/lib/Format/ContinuationIndenter.cpp
1670–1674

In YAML we wouldn't need to support empty optional being *explicitly* specified - it would just be the default.

So specifying DesignatedInitializerIndentWidth: 4 would set the std::optional<unsigned> to 4 but if DesignatedInitializerIndentWidth was omitted from the YAML then the optional would simply not be set during parsing.

Of course, if we were to change PPIndentWidth to work that way too, it would technically be a breaking change because users may have *explicitly* specified -1 in their YAML.

You need an explicit entry, because you need to be able to write the empty optional on --dump-config.

jp4a50 added inline comments.Mar 29 2023, 4:18 AM
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

In YAML we wouldn't need to support empty optional being *explicitly* specified - it would just be the default.

So specifying DesignatedInitializerIndentWidth: 4 would set the std::optional<unsigned> to 4 but if DesignatedInitializerIndentWidth was omitted from the YAML then the optional would simply not be set during parsing.

Of course, if we were to change PPIndentWidth to work that way too, it would technically be a breaking change because users may have *explicitly* specified -1 in their YAML.

You need an explicit entry, because you need to be able to write the empty optional on --dump-config.

It looks like the YAML IO logic just does the right thing (TM) with std::optionals. When calling IO.mapOptional() on output, it simply doesn't write the key out if the value is an empty optional. So I don't think this is an issue.

As @owenpan says, though, there is still the issue of backward compatibility with PPIndentWidth.

I don't feel strongly about which way to go so I'll leave it to you two to decide!

owenpan added inline comments.Mar 29 2023, 5:50 PM
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

As @owenpan says, though, there is still the issue of backward compatibility with PPIndentWidth.

I don't feel strongly about which way to go so I'll leave it to you two to decide!

@MyDeveloperDay @rymiel can you weigh in?

rymiel added inline comments.Mar 29 2023, 6:53 PM
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

can you weigh in?

Well, as someone with experience with YAML, but with no experience with LLVM's YAML stuff, I'd suggest making it null (explicitly), but a) i don't know if that's supported and b) i'm not sure if it's semantically any clearer than just -1

MyDeveloperDay added inline comments.Mar 30 2023, 1:22 AM
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

I'd do the right think with DesignatedInitializerIndentWidth which I guess is to use the std::optional that @owenpan suggests and don't worry about PPIndentWidth for now,

if anything if it works I'd prefer to understand if we can turn PPIndentWidth into a std::optional later (in a seperate review) and just catch the -1 case so at least the code is nicer, but that is a different task

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 contributors) should consider whether users should have the option to configure other similar types of indentation following opening braces.

I chatted to the owner of the KJ style guide and, whilst he did not have extremely strong opinions one way or another, he and I agreed that it probably makes more sense for such a config option to apply to other types of braced init lists.

Broadly speaking, these include aggregate initialization and list initialization (possibly direct initialization with braces too). See the initialization cppref article for links to all these.

As such, I would propose to actually rename DesignatedInitializerIndentWidth to BracedInitializerIndentWidth (but open to suggestiosn on exact naming) and have it apply to all the above types of initialization.

What does everyone think?

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 contributors) should consider whether users should have the option to configure other similar types of indentation following opening braces.

I chatted to the owner of the KJ style guide and, whilst he did not have extremely strong opinions one way or another, he and I agreed that it probably makes more sense for such a config option to apply to other types of braced init lists.

Broadly speaking, these include aggregate initialization and list initialization (possibly direct initialization with braces too). See the initialization cppref article for links to all these.

As such, I would propose to actually rename DesignatedInitializerIndentWidth to BracedInitializerIndentWidth (but open to suggestiosn on exact naming) and have it apply to all the above types of initialization.

What does everyone think?

Would be okay for me. But then I want the documentation and tests show nested initialization (array of struct for example).

clang/lib/Format/ContinuationIndenter.cpp
1670–1674

In YAML we wouldn't need to support empty optional being *explicitly* specified - it would just be the default.

So specifying DesignatedInitializerIndentWidth: 4 would set the std::optional<unsigned> to 4 but if DesignatedInitializerIndentWidth was omitted from the YAML then the optional would simply not be set during parsing.

Of course, if we were to change PPIndentWidth to work that way too, it would technically be a breaking change because users may have *explicitly* specified -1 in their YAML.

You need an explicit entry, because you need to be able to write the empty optional on --dump-config.

It looks like the YAML IO logic just does the right thing (TM) with std::optionals. When calling IO.mapOptional() on output, it simply doesn't write the key out if the value is an empty optional. So I don't think this is an issue.

As @owenpan says, though, there is still the issue of backward compatibility with PPIndentWidth.

I don't feel strongly about which way to go so I'll leave it to you two to decide!

As @MyDeveloperDay said, ignore PPIndentWidth, that will be dealt with on a different occasion. Use the optional, it is the right thing (TM) to do.
For the yaml stuff, I for one like to define everything (even it has the default value), thus I'd like the -1 or something on output. But if that leads to messing around with the yaml code just use what it does.

Broadly speaking, these include aggregate initialization and list initialization (possibly direct initialization with braces too). See the initialization cppref article for links to all these.

As such, I would propose to actually rename DesignatedInitializerIndentWidth to BracedInitializerIndentWidth (but open to suggestiosn on exact naming) and have it apply to all the above types of initialization.

What does everyone think?

+1.

clang/lib/Format/ContinuationIndenter.cpp
1670–1674

I'd do the right think with DesignatedInitializerIndentWidth which I guess is to use the std::optional that @owenpan suggests and don't worry about PPIndentWidth for now

+1.

jp4a50 updated this revision to Diff 509982.Mar 31 2023, 4:09 AM

Replace DesignatedInitializerIndentWidth with BracedInitializerIndentWidth which applies to a broader range of initializers.

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 one like to define everything (even it has the default value), thus I'd like the -1 or something on output. But if that leads to messing around with the yaml code just use what it does.

Pretty sure I would have to modify the YAML code in order to get it to output something when std::optional<unsigned> is set to std::nullopt so I have left it as-is.

PTAL.

jp4a50 added inline comments.Mar 31 2023, 4:16 AM
clang/docs/tools/dump_format_style.py
72–78

I changed this from subn to match here since it's just a simpler way of expressing the same thing.

jp4a50 retitled this revision from [clang-format] Add DesignatedInitializerIndentWidth option. to [clang-format] Add BracedInitializerIndentWidth option..Mar 31 2023, 4:17 AM
jp4a50 edited the summary of this revision. (Show Details)
MyDeveloperDay added inline comments.Mar 31 2023, 4:19 AM
clang/include/clang/Format/Format.h
949

did you check generating the html from the rst? I can never remember if we need a newline before the \code

4341

can this be alphabetic

clang/lib/Format/Format.cpp
910

also alphabetic

1379

ditto alphabetic

rymiel added inline comments.Mar 31 2023, 5:22 AM
clang/docs/tools/dump_format_style.py
72–78

(Just FYI, those pythons sources are pretty ancient and untouched, I planned on refactoring the whole thing using more modern, idiomatic Python but then concluded that it's not really necessary)

jp4a50 added inline comments.Mar 31 2023, 5:32 AM
clang/include/clang/Format/Format.h
949

Nope - how do I do that exactly? I would guess a newline is not needed based on other examples.

jp4a50 updated this revision to Diff 510022.Mar 31 2023, 7:05 AM

Alphabetical ordering.

clang/include/clang/Format/Format.h
949

did you check generating the html from the rst? I can never remember if we need a newline before the \code

clang/lib/Format/ContinuationIndenter.cpp
1665

Why did you move it?

1669–1673

You can keep the local variable if you want, but please use value_or, it expresses the intent better.

owenpan added inline comments.Mar 31 2023, 5:30 PM
clang/include/clang/Format/Format.h
949

Nope - how do I do that exactly? I would guess a newline is not needed based on other examples.

See D147327#4236718.

jp4a50 updated this revision to Diff 510886.Apr 4 2023, 12:12 PM

Minor review comments.

jp4a50 added inline comments.Apr 4 2023, 12:14 PM
clang/include/clang/Format/Format.h
949

HTML looks good.

clang/lib/Format/ContinuationIndenter.cpp
1665

I originally needed it in the new else if block since I was checking if it was a designated initializer period but the condition has since changed. Thanks for spotting. I've moved it back.

1669–1673

Have used .value_or() and got rid of temp variable since it's more concise now.

jp4a50 added a comment.Apr 5 2023, 1:18 PM

Following on from our discussion about new options needing motivation from public style guides, I've updated the KJ style guide to clarify its stance on braced init lists: https://github.com/capnproto/capnproto/blob/master/style-guide.md#spacing-and-bracing

jp4a50 marked 4 inline comments as done.Apr 6 2023, 11:39 AM

Just FYI this is ready for review again. I believe I've addressed all comments.

Can you mark your comments as done

jp4a50 marked 29 inline comments as done.Apr 7 2023, 6:07 AM

Marked comments as done.

sstwcw added a subscriber: sstwcw.Apr 7 2023, 7:42 AM
sstwcw added inline comments.
clang/docs/tools/dump_format_style.py
72–78

Is curdeius the one who knows about the Python scripts and the YAML parser? Did he move on to meaningful things?

Ping for review again plz.

MyDeveloperDay accepted this revision.Apr 12 2023, 5:47 AM

If all comments and concerns are done, then I'm inclined to accept, but I'd like @owenpan and @HazardyKnusperkeks to give their opinion before we land this.

This revision is now accepted and ready to land.Apr 12 2023, 5:47 AM

If all comments and concerns are done, then I'm inclined to accept, but I'd like @owenpan and @HazardyKnusperkeks to give their opinion before we land this.

Sure. Thanks!

clang/lib/Format/ContinuationIndenter.cpp
1670–1674

In YAML we wouldn't need to support empty optional being *explicitly* specified - it would just be the default.

So specifying DesignatedInitializerIndentWidth: 4 would set the std::optional<unsigned> to 4 but if DesignatedInitializerIndentWidth was omitted from the YAML then the optional would simply not be set during parsing.

Of course, if we were to change PPIndentWidth to work that way too, it would technically be a breaking change because users may have *explicitly* specified -1 in their YAML.

You need an explicit entry, because you need to be able to write the empty optional on --dump-config.

It looks like the YAML IO logic just does the right thing (TM) with std::optionals. When calling IO.mapOptional() on output, it simply doesn't write the key out if the value is an empty optional. So I don't think this is an issue.

As @owenpan says, though, there is still the issue of backward compatibility with PPIndentWidth.

I don't feel strongly about which way to go so I'll leave it to you two to decide!

As @MyDeveloperDay said, ignore PPIndentWidth, that will be dealt with on a different occasion. Use the optional, it is the right thing (TM) to do.
For the yaml stuff, I for one like to define everything (even it has the default value), thus I'd like the -1 or something on output. But if that leads to messing around with the yaml code just use what it does.

@HazardyKnusperkeks @owenpan, before potentially committing this change, I just wanted to draw your attention again to this comment to confirm that you are happy with the current implementation which doesn't explicitly print null or similar for a default value of DesignatedInitializerIndentWidth when dumping the config. I'm assuming that's OK since @HazardyKnusperkeks suggested that we don't bother if it involves messing around with the yaml code (which it would).

HazardyKnusperkeks added inline comments.
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

@HazardyKnusperkeks @owenpan, before potentially committing this change, I just wanted to draw your attention again to this comment to confirm that you are happy with the current implementation which doesn't explicitly print null or similar for a default value of DesignatedInitializerIndentWidth when dumping the config. I'm assuming that's OK since @HazardyKnusperkeks suggested that we don't bother if it involves messing around with the yaml code (which it would).

Sure, everything is fine.

owenpan accepted this revision.Apr 12 2023, 1:07 PM
owenpan added inline comments.
clang/lib/Format/ContinuationIndenter.cpp
1670–1674

Looks good.

Commit details as follows as per other diffs:

Name: Jon Phillips
Email: jonap2811@gmail.com

Would appreciate someone committing for me.

Would appreciate someone committing for me.

Can you rebase it? I got a conflict in ReleaseNotes.rst.

Would appreciate someone committing for me.

Can you rebase it? I got a conflict in ReleaseNotes.rst.

@owenpan apologies for the delay. I've rebased now.

@jp4a50 There's a mismatch between Format.h and and the resulting rst file. I'll rerun dump_format_style.py to fix it before merging.

This revision was automatically updated to reflect the committed changes.