Issue 71563
Summary [FR] clang-format option for line breaks after [[attributes]] in function scope
Labels clang-format
Assignees
Reporter FalcoGer
    Currently there is no clang-format option for attributes like `[[maybe_unused]]` or `[[likely]]`. Right now clang-format will always force them onto the same line as the item.

```c++
int main()
{
 [[maybe_unused]]
    int y = 5;

    [[likely]]
    if (5 == 5) {}
    else {}
}
```

will always end up as, with no option to change the behavior

```c++
int main()
{
    [[maybe_unused]] int y = 5;

    [[likely]] if (5 == 5) {}
    else {}
// ~~~~
//  ^ Different indentation for 'if' and corresponding 'else' (clang-tidy readability-misleading-indentation)
}
```

This is especially bothersome for the `if` because it leads to clang-tidy to report the misleading indentation.

It would be nice if there were an option for line breaks after such attributes.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to