<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 - Invalid handling of AfterControlStatement: MultiLine"
href="https://bugs.llvm.org/show_bug.cgi?id=46633">46633</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Invalid handling of AfterControlStatement: MultiLine
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>10.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>normal
</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>varqox@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>With the following .clang-format file:
====================
Language: Cpp
BreakBeforeBraces: Custom
BraceWrapping:
AfterControlStatement: MultiLine
ColumnLimit: 80
IndentWidth: 4
====================
running clang-format on
====================
void foo() {
if (very_long_variable_name or other_very_long_variable_name or
long_variable)
{
return;
}
}
====================
produces:
====================
void foo() {
if (very_long_variable_name or other_very_long_variable_name or
long_variable) {
return;
}
}
====================
Expected output: the same as input.
Command used: clang-format bug.cc
clang-format version: 10.0.0
Additional notes:
If you change "long_variable)" to "long_variable123)" or "long_variab)"
formatting is correct -- the brace gets wrapped. So it seems that if an if
condition ends slightly after the column limit (if placed in a single line),
then it is formatted incorrectly.</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>