[all-commits] [llvm/llvm-project] dd06b8: [clang-format] Fix anonymous reference parameter w...

rayroudc via All-commits all-commits at lists.llvm.org
Wed Mar 27 11:59:53 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dd06b8e679fd28f51cd065401062041a40b87f9c
      https://github.com/llvm/llvm-project/commit/dd06b8e679fd28f51cd065401062041a40b87f9c
  Author: rayroudc <rayroudc at gmail.com>
  Date:   2024-03-27 (Wed, 27 Mar 2024)

  Changed paths:
    M clang/lib/Format/WhitespaceManager.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] Fix anonymous reference parameter with default value (#86254)

When enabling alignment of consecutive declarations and reference right
alignment, the needed space between `& ` and ` = ` is removed in the
following use case.

Problem (does not compile)
```
int    a(const Test    &= Test());
double b();
```

Expected:
```
int    a(const Test & = Test());
double b();
```

Test command:

```
echo "int    a(const Test& = Test()); double b();" | clang-format -style="{AlignConsecutiveDeclarations: true, ReferenceAlignment: Right}"
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list