<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Unexpected breaks after 'endl'"
href="https://bugs.llvm.org/show_bug.cgi?id=38873">38873</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Unexpected breaks after 'endl'
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jzpigtc4zsi@0box.eu
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>