Repro: $ cat sample.c int* a; unsigned long long x; double* b; $ clang-format -style="{PointerAlignment: Right, AlignConsecutiveDeclarations: true}" sample.c int * a; unsigned long long x; double * b; Expected/desired output is: int *a; unsigned long long x; double *b;
+1 I'd like to get this fixed as well. With current implementation, AlignConsecutiveDeclarations breaks PointerAlignment.
In the code (clang/lib/Format/WhitespaceManager.cpp:449) contains a comment about this. It states it is unclear how const char* const* v1; float const* v2; SomeVeryLongType const& v3; should be aligned. Does everyone agree that const char *const *v1; float const *v2; SomeVeryLongType const &v3; is correct? Or does anyone want: const char *const *v1; Or something else?
Addressed by https://reviews.llvm.org/D27651
https://reviews.llvm.org/D103245