[llvm-bugs] [Bug 34151] New: Clang-Format: Option AlignConsecutiveAssignments not working with Statement-Expressions
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 11 00:34:51 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34151
Bug ID: 34151
Summary: Clang-Format: Option AlignConsecutiveAssignments not
working with Statement-Expressions
Product: clang
Version: 5.0
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: sebastiankeller at fastmail.net
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
Created attachment 18963
--> https://bugs.llvm.org/attachment.cgi?id=18963&action=edit
clang-format configuration file
Hello,
it seems like the open `AlignConsecutiveAssignments` in combination with
statement expressions is not working correctly (anymore).
All equal signs are placed on the first lines equal sign, if possible.
This leads to some weird formatting if the name is too short or very long.
```
#include <stdio.h>
int test() {
// If the name (a) is short the formatting is off
int a = ({
int b= 1;
int c= b + 1;
int d= c + 1;
d
});
/**
* Is it possible to have it that way?
*/
// int a = ({
// int b = 1;
// int c = b + 1;
// int d = c + 1;
// d
// });
// ------------------------------
// It seems not so bad here, but if the longerName gets event longer it
// becomes worse
int longerName = ({
int bb = 1;
int cccc = b + 1;
int dd = c + 1;
d;
});
int somethingRidiculousLongProbablyWithBadNamingAndATpyo = ({
int bb = 1;
int cccc = b + 1;
int dd = c + 1;
d;
});
/**
* I think this would be the right formatting.
*/
// int somethingRidiculousLongProbablyWithBadNamingAndATpyo = ({
// int bb = 1;
// int cccc = b + 1;
// int dd = c + 1;
// d;
// });
return a;
}
```
The .clang-format file is as following
```
---
Language: Cpp
BasedOnStyle: Google
AlignConsecutiveAssignments: true
...
```
Thank you very much!
--
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/20170811/a88e967c/attachment-0001.html>
More information about the llvm-bugs
mailing list