[all-commits] [llvm/llvm-project] f8a059: [clang-format] Align comments following continued ...

sstwcw via All-commits all-commits at lists.llvm.org
Mon Oct 27 11:41:31 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f8a0599d761e4283b3877f0bf4043e01722dc448
      https://github.com/llvm/llvm-project/commit/f8a0599d761e4283b3877f0bf4043e01722dc448
  Author: sstwcw <su3e8a96kzlver at posteo.net>
  Date:   2025-10-27 (Mon, 27 Oct 2025)

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

  Log Message:
  -----------
  [clang-format] Align comments following continued aligned lines (#164687)

new

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return;                         //
};

auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return aaaaaaaaaaaaaaaaaaaaa;   //
};
```

old

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return;     //
};

auto aaaaaaaaaaaaaaaaaaaaa = {};                    //
auto b                     = [] {                   //
  return aaaaaaaaaaaaaaaaaaaaa; //
};
```

Aligning a line to another line involves keeping track of the tokens'
positions. Previously the shift was incorrectly added to some tokens
that did not move. Then the comments would end up in the wrong places.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list