Issue 139717
Summary [clang-format]: Feature Request add option to ReferenceAlignment when using east-const
Labels clang-format
Assignees
Reporter LucHermitte
    It would be nice to have a way to have an extra option to `ReferenceAlignment` (and `PointerAlignment` I guess) when `QualifierAlignment` is set to `Right` in order to remove any space between `const` and `&`, and still add spaces before `&` the rest of the time.

AFAIK, it is currently (*)  impossible to format in the following way:

```c++
SomeType & lvref;       // space before "&"
SomeType && rvref;      // space before "&&"
SomeType const& cref;   // no-space before "&", but before "const&"
SomeType const&& crvref // same thing
```

Indeed, if we select `Middle` for `ReferenceAlignment`, an extra space will be added to `const &`

(*) tested with clang-format 19, and the documentation of clang-format-21 shows no difference on the topic.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to