[llvm-bugs] [Bug 38873] New: Unexpected breaks after 'endl'
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 7 14:49:18 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38873
Bug ID: 38873
Summary: Unexpected breaks after 'endl'
Product: clang
Version: 6.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: jzpigtc4zsi at 0box.eu
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
If ColumnLimit high enough (but not zero) then the statement fits in a single
line:
$ echo -e 'void fu(void) {\ncerr << endl << endl << "A" << endl << endl << endl
<< "B" << endl;\n}' |clang-format -style="{BasedOnStyle: LLVM, ColumnLimit:
200, AlignAfterOpenBracket: DontAlign, AlignOperands: false}"
void fu(void) { cerr << endl << endl << "A" << endl << endl << endl << "B" <<
endl; }
If ColumnLimit does not allow single line, then the line is breaked (wrapped)
-- but into too many pieces:
$ echo -e 'void fu(void) {\ncerr << endl << endl << "A" << endl << endl << endl
<< "B" << endl;\n}' |clang-format -style="{BasedOnStyle: LLVM, ColumnLimit: 60,
AlignAfterOpenBracket: DontAlign, AlignOperands: false}"
void fu(void) {
cerr << endl
<< endl
<< "A" << endl
<< endl
<< endl
<< "B" << endl;
}
After each and every 'endl' a break is introduced. Why? Any rationale or
intention?
Moreover, "ColumnLimit: 0" ("infinite limit") is NOT respected! I expected the
same behaviour as with "ColumnLimit: 220" (or 20000 or any very high value).
$ echo -e 'void fu(void) {\ncerr << endl << endl << "A" << endl << endl << endl
<< "B" << endl;\n}' |clang-format -style="{BasedOnStyle: LLVM, ColumnLimit: 0,
AlignAfterOpenBracket: DontAlign, AlignOperands: false}"
void fu(void) {
cerr << endl
<< endl
<< "A" << endl
<< endl
<< endl
<< "B" << endl;
}
Moreover, alignment occurs, despite that alignments are prohibited (each type).
--
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/20180907/73f24bc8/attachment.html>
More information about the llvm-bugs
mailing list