[all-commits] [llvm/llvm-project] ee3b2c: [clang-format] PR50525 doesn't handle AlignConsecu...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Sat Jun 26 05:31:09 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ee3b2c47ce41aeabede85d96e43bee33be73aa2f
      https://github.com/llvm/llvm-project/commit/ee3b2c47ce41aeabede85d96e43bee33be73aa2f
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2021-06-26 (Sat, 26 Jun 2021)

  Changed paths:
    M clang/lib/Format/WhitespaceManager.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

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

AlignConsecutiveAssignments/Declarations cause incorrect alignment in the presence of a DesignatedInitializerPeriod (https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html)

```
static NTSTATUS stg(PLW_STREAM Stream, int identity)
{
     NTSTATUS             status;
     BYTE                 payload[256] = {'l', 'h', 'o', 't', 's', 'e'};
     struct dm_rpc_header header       = {.drh_magic        = DRH_MAGIC,
                                    .drh_op_code      = RPC_OP_ECHO,
                                    .drh_payload_size = sizeof(payload),
                                    .drh_body_size    = sizeof(payload),
                                    .drh_request_id   = 1};
     header.drh_version                = identity;
```

This fix addresses that by ensuring the period isn't ignored

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D104900




More information about the All-commits mailing list