<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 - clang-format: doesn't handle AlignConsecutiveAssignments correctly in some situation."
href="https://bugs.llvm.org/show_bug.cgi?id=50525">50525</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-format: doesn't handle AlignConsecutiveAssignments correctly in some situation.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>darwin.xu@icloud.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>Created <span class=""><a href="attachment.cgi?id=24899" name="attach_24899" title="clang-format config file">attachment 24899</a> <a href="attachment.cgi?id=24899&action=edit" title="clang-format config file">[details]</a></span>
clang-format config file
The config file is attached.
---- The expected code is: ----
01: static NTSTATUS stg(PLW_STREAM Stream, int identity)
02: {
03: NTSTATUS status;
04: BYTE payload[256] = {'l', 'h', 'o', 't', 's', 'e'};
05: struct dm_rpc_header header = {.drh_magic = DRH_MAGIC,
06: .drh_op_code = RPC_OP_ECHO,
07: .drh_payload_size =
sizeof(payload),
08: .drh_body_size =
sizeof(payload),
09: .drh_request_id = 1};
10: header.drh_version = identity;
---- The output of clang-format is: ----
01: static NTSTATUS stg(PLW_STREAM Stream, int identity)
02: {
03: NTSTATUS status;
04: BYTE payload[256] = {'l', 'h', 'o', 't', 's', 'e'};
05: struct dm_rpc_header header = {.drh_magic = DRH_MAGIC,
06: .drh_op_code = RPC_OP_ECHO,
07: .drh_payload_size = sizeof(payload),
08: .drh_body_size = sizeof(payload),
09: .drh_request_id = 1};
10: header.drh_version = identity;
It seems that clang-format assumes that line 05 isn't align with the previous
line is the reason line 06 is like this.
05: struct dm_rpc_header header = {.drh_magic = DRH_MAGIC,
06: .drh_op_code = RPC_OP_ECHO,</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>