llvm / llvm/llvm-project

[clang-format] extra space added within comments that use double asterisks to close

Open
#187,764 2 comments 0 reactions 0 assignees View on GitHub
clang-format confirmed
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

I'm seeing strange comment formatting behavior with clang-format 21. I've confirmed the problem exists at HEAD (LLVM 23.0.0) as well. Minimal reproducer:

```
# dot-clang-format
ColumnLimit: 80
ReflowComments: true
PenaltyExcessCharacter: 10
```

```
# test.cc
/**
* This test verifies the special code path. It currently exists for code coverage.
**/
void test() {}
```

Note how an extra space is added between "code" and "coverage":

```
$ clang-format --style=file:dot-clang-format test.cc
/**
* This test verifies the special code path. It currently exists for code coverage.
**/
void test() {}
```

This _only_ happens when the close of the comment block uses `**/` (double asterisk). If the block closes with `*/` this behavior does not occur.

Bisection reveals this was introduced with f771d08.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.