[all-commits] [llvm/llvm-project] 64df51: [clang-format] Fix misaligned trailing comments in...

Marek Kurdej via All-commits all-commits at lists.llvm.org
Fri Jan 28 13:29:02 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 64df51624f08f3b8d7370f820ab3545b1de98a0e
      https://github.com/llvm/llvm-project/commit/64df51624f08f3b8d7370f820ab3545b1de98a0e
  Author: Marek Kurdej <marek.kurdej+llvm.org at gmail.com>
  Date:   2022-01-28 (Fri, 28 Jan 2022)

  Changed paths:
    M clang/lib/Format/BreakableToken.cpp
    M clang/unittests/Format/FormatTestComments.cpp

  Log Message:
  -----------
  [clang-format] Fix misaligned trailing comments in the presence of an empty block comment.

Fixes https://github.com/llvm/llvm-project/issues/53441.

Expected code:
```
/**/   //
int a; //
```

was before misformatted to:
```
/**/     //
int a; //
```

Because the "remaining length" (after the starting `/*`) of an empty block comment `/**/` was computed to be 0 instead of 2.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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




More information about the All-commits mailing list