Skip to content

[clang-format] Change the clang-format style to always break on template declarations. #35678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

gottesmm
Copy link
Contributor

Specifically, I am changin about is called BreakTemplateDeclarationsStyle from
BTDS_No (the current value) to BTDS_Yes. The two differences are:

BTDS_No (in configuration: No) Do not force break before declaration. PenaltyBreakTemplateDeclaration is taken into account.
template <typename T> T foo() {
}
template <typename T> T foo(int aaaaaaaaaaaaaaaaaaaaa,
                            int bbbbbbbbbbbbbbbbbbbbb) {
}
BTDS_Yes (in configuration: Yes) Always break after template declaration.
template <typename T>
T foo() {
}
template <typename T>
T foo(int aaaaaaaaaaaaaaaaaaaaa,
      int bbbbbbbbbbbbbbbbbbbbb) {
}

If one looks at the code base, most templates already look like BTDS_Yes except
for instances where clang-format performed it. Change the clang-format style to
stop this from happening incrementally.

…ate declarations.

Specifically, I am changin about is called BreakTemplateDeclarationsStyle from
BTDS_No (the current value) to BTDS_Yes. The two differences are:

```
BTDS_No (in configuration: No) Do not force break before declaration. PenaltyBreakTemplateDeclaration is taken into account.
template <typename T> T foo() {
}
template <typename T> T foo(int aaaaaaaaaaaaaaaaaaaaa,
                            int bbbbbbbbbbbbbbbbbbbbb) {
}
```

```
BTDS_Yes (in configuration: Yes) Always break after template declaration.
template <typename T>
T foo() {
}
template <typename T>
T foo(int aaaaaaaaaaaaaaaaaaaaa,
      int bbbbbbbbbbbbbbbbbbbbb) {
}
```

If one looks at the code base, most templates already look like BTDS_Yes except
for instances where clang-format performed it. Change the clang-format style to
stop this from happening incrementally.
@gottesmm gottesmm requested a review from atrick January 31, 2021 21:00
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@tschuett
Copy link
Contributor

You are missing a line-break.

@gottesmm
Copy link
Contributor Author

@tschuett the format doesn't require that. If you want to put up a commit that does that feel free to do so. I want to move onto something else.

@gottesmm gottesmm merged commit f9e3f29 into swiftlang:main Jan 31, 2021
@gottesmm gottesmm deleted the pr-36889f6fa9cd4b87118250ce0bb7d809ffd38c00 branch January 31, 2021 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants