https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 01/11] [clang-format] Add BreakBeforeTemplateClose option
---
clang/d
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 01/10] [clang-format] Add BreakBeforeTemplateClose option
---
clang/d
leijurv wrote:
Oh gosh, that's embarrassing. It looks like I was so focused on the column
limit that I didn't cover cases where the column limit doesn't break the
template fully. In other words, I would just type "Fooo"
and force it onto the next line, without noticing that
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/9] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
https://github.com/mydeveloperday approved this pull request.
This looks good to me but please wait for @owenca to approve
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/c
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
owenca wrote:
Why doesn't it break before the `>` for the example (a.cc) below?
```cpp
template
class C {
void f() {}
};
```
Command line:
```
clang-format -style='{BreakBeforeTemplateCloser: Multiline, ColumnLimit: 26}'
a.cc
```
https://github.com/llvm/llvm-project/pull/118046
_
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/8] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
leijurv wrote:
I apologize for forgetting `clang-format-check-format`
You're right that I had still missed some more cases of `verifyNoChange`. I've
changed those now in
https://github.com/llvm/llvm-project/pull/118046/commits/130428887e534cc3bfdfeec5846df2fd1e939667.
The last two remaining `
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/7] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/6] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
https://github.com/owenca edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -6,6 +6,275 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp);
+ // Begin with tests covering the case where there is no constra
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
@@ -2252,6 +2252,25 @@ struct FormatStyle {
/// \version 16
BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
+ /// If ``true``, a line break will be placed before the ``>`` in a multiline
+ /// template declaration.
+ /// \code
+ ///true:
+ ///templat
https://github.com/owenca commented:
You can run `ninja clang-format-check-format` to make sure your patch is
correctly formatted before pushing.
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
owenca wrote:
> > I think this should be covered by BlockIndent
>
> My understanding from looking at past PRs to clang-format was that backwards
> compatibility was a top requirement. If I changed the behavior of BlockIndent
> to put the `>` on the next line, that would change a lot of existin
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff db88071a8b24ad9302659ee88383eea69a732f11
19bc40e7d824804ebcd9839cb2155a704d368e36 --e
leijurv wrote:
Thank you for the review @owenca
> I think this should be covered by BlockIndent
My understanding from looking at past PRs to clang-format was that backwards
compatibility was a top requirement. If I changed the behavior of BlockIndent
to put the `>` on the next line, that wou
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/5] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
https://github.com/owenca commented:
About the test cases:
- Call `verifyFormat` instead of `verifyNoChange` whenever possible.
- Don't end a test case with a newline. (Search for `\n",` and `\n")`.)
- Capitalize the first word of a comment and end the comment with a `.` (or `:`
if appropriate).
owenca wrote:
> > Maybe we should make it a sub-option for `BlockIndent`. I'm seeing a
> > possible need for having control over other kinds of block indented
> > structures such as Lambdas. I suspect the way this option has been
> > implemented it interacts with the alignment options anyway.
leijurv wrote:
Thank you! It looks like I don't have permissions to merge, if you have them,
could you?
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/lis
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/4] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
leijurv wrote:
Ping :pray:
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/4] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/4] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
@@ -11077,6 +11077,281 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp);
+ Style.ColumnLimit = 0;
+ verifyNoChange("template \n"
+
@@ -11077,6 +11077,281 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp);
+ Style.ColumnLimit = 0;
+ verifyNoChange("template \n"
+
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
HazardyKnusperkeks wrote:
Sorry missed that, didn't look for the lambda case.
https://github.com/llvm/llvm-
@@ -11077,6 +11077,281 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp);
+ Style.ColumnLimit = 0;
+ verifyNoChange("template \n"
+
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
leijurv wrote:
Sorry if I misunderstood, but, I thought I added that here:
![Screenshot_20241224-154618](ht
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
HazardyKnusperkeks wrote:
This one is still missing.
https://github.com/llvm/llvm-project/pull/118046
_
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
leijurv wrote:
Sure!
https://github.com/llvm/llvm-project/pull/118046/commits/2c3a64c8f32a5c43887db4d107a41
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp);
+ Style.ColumnLimit = 0;
+ verifyNoChange("template \n"
+
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/4] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp);
+ Style.ColumnLimit = 0;
+ verifyNoChange("template \n"
+
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
HazardyKnusperkeks wrote:
One additional test: How about nested templates?
`template typename T>` for exampl
leijurv wrote:
Ping 🙏
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -11077,6 +11077,157 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
leijurv wrote:
Good suggestion! I have added tests in this commit:
https://github.com/llvm/llvm-project/pul
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/3] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/3] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
@@ -11077,6 +11077,157 @@ TEST_F(FormatTest,
WrapsTemplateDeclarationsWithComments) {
Style);
}
+TEST_F(FormatTest, BreakBeforeTemplateClose) {
HazardyKnusperkeks wrote:
I want to see some lambdas and template usages (not declarations).
https://github
leijurv wrote:
> I think you should add test cases with multiple `>>` closing, see
> `UnderstandsTemplateParameters` for example.
>
> Consider trying the code snippet mentioned in #80049 as well.
Thank you for the suggestion! I have integrated that test case. It indicated
that I was being too
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH 1/2] [clang-format] Add BreakBeforeTemplateClose option
---
clang/doc
gedare wrote:
I think you should add test cases with multiple `>>` closing, see
`UnderstandsTemplateParameters` for example.
Consider trying the code snippet mentioned in
https://github.com/llvm/llvm-project/issues/80049 as well.
https://github.com/llvm/llvm-project/pull/118046
_
gedare wrote:
> > Yes. I followed the code that implements `AlignAfterOpenBracket:
> > BlockIndent`, except applying to ClosesTemplateDeclaration. I made it a new
> > setting for backwards compatibility. 👍
>
> Maybe we should make it a sub-option for `BlockIndent`. I'm seeing a possible
> nee
gedare wrote:
> Yes. I followed the code that implements `AlignAfterOpenBracket:
> BlockIndent`, except applying to ClosesTemplateDeclaration. I made it a new
> setting for backwards compatibility. 👍
Maybe we should make it a sub-option for `BlockIndent`. I'm seeing a possible
need for having
leijurv wrote:
Yes. I followed the code that implements `AlignAfterOpenBracket: BlockIndent`,
except applying to ClosesTemplateDeclaration. I made it a new setting for
backwards compatibility. 👍
https://github.com/llvm/llvm-project/pull/118046
___
cf
gedare wrote:
Would this also be equivalent to supporting `AlignAfterOpenBracket:
BlockIndent` for angle brackets?
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/
leijurv wrote:
Ping :pray:
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 1caf823165b16f6701993d586df51d5cdbf0885e Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH] [clang-format] Add BreakBeforeTemplateClose option
---
clang/docs/Cl
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From b254c9311fb91374a21ba6ac5d44e087e4a55e98 Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH] [clang-format] Add BreakBeforeTemplateClose option
---
clang/docs/Cl
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From efb5b98de8817ce02a226353d9f5e36095874b27 Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH] [clang-format] Add BreakBeforeTemplateClose option
---
clang/docs/Cl
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 4df01e5c4b5a5b4872c9d4f28c5bdce60ad79b84 Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH] [clang-format] Add BreakBeforeTemplateClose option
---
clang/docs/Cl
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 79b3767b39d6d5d5c21bb461fb619651fb2443c5 Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH] [clang-format] Add BreakBeforeTemplateClose option
---
clang/docs/Cl
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang-format
Author: leijurv (leijurv)
Changes
In clang-format, multiline templates have the `>` on the same line as the
last parameter:
```c++
template<
typename Foo,
typename Bar,
typename Baz>
void foo() {
```
I would like to add an opt
https://github.com/leijurv ready_for_review
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/leijurv updated
https://github.com/llvm/llvm-project/pull/118046
>From 217f80766d1eeeab4195f5d79cfed79c06657166 Mon Sep 17 00:00:00 2001
From: Leijurv
Date: Fri, 29 Nov 2024 21:54:36 -0600
Subject: [PATCH] BreakBeforeTemplateClose
---
clang/docs/ClangFormatStyleOptions.rst
https://github.com/leijurv edited
https://github.com/llvm/llvm-project/pull/118046
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
78 matches
Mail list logo