diff options
author | leijurv <leijurv@gmail.com> | 2025-02-06 01:15:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-06 01:15:47 -0800 |
commit | d2b45ce100d641a8f1690e30843bb9c5ea71ab86 (patch) | |
tree | ce6d7d8789e85d82656f19a99116801a58dcc2ac /clang/unittests/Format/ConfigParseTest.cpp | |
parent | 7ef33e609c45515de9db1b5222fe6e05edd76c94 (diff) | |
download | llvm-d2b45ce100d641a8f1690e30843bb9c5ea71ab86.zip llvm-d2b45ce100d641a8f1690e30843bb9c5ea71ab86.tar.gz llvm-d2b45ce100d641a8f1690e30843bb9c5ea71ab86.tar.bz2 |
[clang-format] Add BreakBeforeTemplateCloser option (#118046)
In clang-format, multiline templates have the `>` on the same line as
the last parameter:
```c++
template <
typename Foo,
typename Bar>
void foo() {
```
I would like to add an option to put the `>` on the next line, like
this:
```c++
template <
typename Foo,
typename Bar
>
void foo() {
```
An example of a large project that uses this style is NVIDIA's CUTLASS,
here is an example:
https://github.com/NVIDIA/cutlass/blob/main/include/cutlass/epilogue/dispatch_policy.hpp#L149-L156
My reasoning is that it reminds me of this style of braces:
```c++
if (foo()) {
bar();
baz();}
```
Most people agree this is better:
```c++
if (foo()) {
bar();
baz();
}
```
---------
Co-authored-by: Owen Pan <owenpiano@gmail.com>
Diffstat (limited to 'clang/unittests/Format/ConfigParseTest.cpp')
-rw-r--r-- | clang/unittests/Format/ConfigParseTest.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 5bb1c00..0cb2a12 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -170,6 +170,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) { CHECK_PARSE_BOOL(BinPackArguments); CHECK_PARSE_BOOL(BreakAdjacentStringLiterals); CHECK_PARSE_BOOL(BreakAfterJavaFieldAnnotations); + CHECK_PARSE_BOOL(BreakBeforeTemplateCloser); CHECK_PARSE_BOOL(BreakBeforeTernaryOperators); CHECK_PARSE_BOOL(BreakStringLiterals); CHECK_PARSE_BOOL(CompactNamespaces); |