[llvm-bugs] [Bug 42161] New: Clang-format Ignores PointerAlignment Setting when Asterisk is Not Directly Attached to Type
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 6 07:07:20 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42161
Bug ID: 42161
Summary: Clang-format Ignores PointerAlignment Setting when
Asterisk is Not Directly Attached to Type
Product: clang
Version: 8.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: matthias.schaefer at versasec.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
.clang-format file:
Language: Cpp
PointerAlignment: Left
After running clang-format the code is formatted as follows:
int* a;
int *c, *d;
int MyClass::*e;
void Foo(int (*Bar)[3]);
As you can see, PointerAlignment is used to format the first declaration but
not for the other 3 declarations. I find it especially awkward that the
addition of the second variable directly affects the placement of the asterisk
for the first declared variable in line 2.
I would expect the formatting to be applied to all occurrences of pointer
declarations even though they might not have a type name directly written left
to the asterisks:
int* a;
int* c, * d;
int MyClass::* e;
void Foo(int (* Bar)[3]);
Note the added white spaces before all asterisks. Also note that the issue
applies to references as well.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190606/ac372d92/attachment.html>
More information about the llvm-bugs
mailing list