| Issue |
52881
|
| Summary |
[clang-format] wrong formatting of CUDA kernel launches (<<<...>>>) when SpacesInAngles is set to Always
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
lahwaacz
|
Minimal reproducible example:
```cuda
__global__ void foo() {}
int main()
{
foo<<<1, 1>>>();
}
```
Let's format it with clang-format (we want to use `SpacesInAngles: Always` in our project):
```
$ clang-format -style "{BasedOnStyle: mozilla, SpacesInAngles: Always}" foo.cu
__global__ void
foo()
{}
int
main()
{
foo< < < 1, 1 > > >();
}
```
Notice that the CUDA kernel launch was re-formatted into `foo< < < 1, 1 > > >()`. OK, let's try to disable clang-format in this block:
```cuda
__global__ void foo() {}
int main()
{
// clang-format off
foo<<<1, 1>>>();
// clang-format on
}
```
But then:
```
$ clang-format -style "{BasedOnStyle: mozilla, SpacesInAngles: Always}" bar.cu
__global__ void
foo()
{}
int
main()
{
// clang-format off
foo< <<1, 1> >>();
// clang-format on
}
```
We got something else, but clang-format still inserted 2 spaces in the block where it should have been disabled.
Tested with clang-format version 13.0.0
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs