https://bugs.llvm.org/show_bug.cgi?id=50525

            Bug ID: 50525
           Summary: clang-format: doesn't handle
                    AlignConsecutiveAssignments correctly in some
                    situation.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: darwin...@icloud.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Created attachment 24899
  --> https://bugs.llvm.org/attachment.cgi?id=24899&action=edit
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,

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to