[llvm-bugs] [Bug 25090] New: AlingConsecutiveAssignment aligns consecutive assignment across scopes
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 7 04:12:07 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=25090
Bug ID: 25090
Summary: AlingConsecutiveAssignment aligns consecutive
assignment across scopes
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: gonzalobg88 at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
Classification: Unclassified
I have the following snippet that clang-format aligns incorrectly when using
the option AlignConsecutiveAssignment:
auto time_steps = view::generate([]() mutable {
static num_t next = 0.;
auto r = next;
next += 1. / 4. * pi;
return r;
})
| view::take(8);
The inner assignments inside the lambda are aligned correctly with respect to
each other, but the outer assignment (outside of the lambda) is aligned
incorrectly, since it has nothing to do with the assignments inside the lambda.
It would be worth checking if similar error appears in other situations like
constructors:
auto one_var = 3;
auto my_var = type {
one_var = 4, 3, 2 };
or control statements:
int one_var = 3;
if ((one_var = 4)) { }
I guess that as a rule of thumb AlignConsecutiveAssignment should only align
consecutive assignments that happen exactly in the same scope. That should
probably fix all the problems since uniform initialization in constructors as
well as expressions inside control statements have all their own scope.
--
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/20151007/390e3fa1/attachment.html>
More information about the llvm-bugs
mailing list