[all-commits] [llvm/llvm-project] e20bc8: [clang-format] Fix PointerAlignment: Right not wor...
Marek Kurdej via All-commits
all-commits at lists.llvm.org
Mon May 16 00:42:30 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e20bc892b6facc56fffc012929157888bb798bed
https://github.com/llvm/llvm-project/commit/e20bc892b6facc56fffc012929157888bb798bed
Author: Marek Kurdej <marek.kurdej+llvm.org at gmail.com>
Date: 2022-05-16 (Mon, 16 May 2022)
Changed paths:
M clang/lib/Format/WhitespaceManager.cpp
M clang/unittests/Format/FormatTest.cpp
Log Message:
-----------
[clang-format] Fix PointerAlignment: Right not working with tab indentation.
Fixes https://github.com/llvm/llvm-project/issues/55407.
Given configuration:
```
UseTab: Always
PointerAlignment: Right
AlignConsecutiveDeclarations: true
```
Before, the pointer was misaligned in this code:
```
void f() {
unsigned long long big;
char *ptr; // misaligned
int i;
}
```
That was due to the fact that when handling right-aligned pointers, the Spaces were changed but StartOfTokenColumn was not.
Also, a tab was used not only for indentation but for spacing too when using `UseTab: ForIndentation` config option:
```
void f() {
unsigned long long big;
char *ptr; // \t after char
int i;
}
```
Reviewed By: owenpan
Differential Revision: https://reviews.llvm.org/D125528
More information about the All-commits
mailing list