[clang-format] Incorrect space for "delete[] *x"
Versions: 14 and main
Input
void f() {
char *x[1] = {new char[10]};
delete[] *x;
}
Output
void f() {
char *x[1] = {new char[10]};
delete[] * x;
}
Expect
same as input
@llvm/issue-subscribers-clang-format
Revision: https://reviews.llvm.org/D132911
@llvm/issue-subscribers-clang-format
@jackhong12
It's still incorrect when --style="{PointerAlignment: Left}"
delete[] *x; -> delete[]* x;
delete[] *(x); -> delete[]*(x);
Perhaps the pointer here should be annotated as UnaryOperator?
@zzyyyl Thanks for reminding me! You are right. The * token here should be UnaryOperator.
I think the configuration, --style="{PointerAlignment: Left}", will not change the alignment of the * token here. So, the result should be:
echo "delete[] *(x);" | clang-format --style="{PointerAlignment: Left}" -> delete[] *(x);
echo "delete[] *x;" | clang-format --style="{PointerAlignment: Left}" -> delete[] *x;