[clang-tools-extra] [clang-tidy] Add new check readability-trailing-comma (PR #173669)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 28 00:33:42 PST 2025
https://github.com/zeyi2 commented:
Personally, I agree with localspook's idea about multiple line checking.
e.g. Code that looks like this are very common
```c
int foo[] = {1, 2, 3};
```
but after this check, it may be transformed to:
```c
int foo[] = {1, 2, 3,};
```
I think the fix adds visual noise.
---
Also, (at first glance) multi line detection will not introduce a lot of new code, we can just check if `SM.getExpansionLineNumber(InitList->getBeginLoc())` and `SM.getExpansionLineNumber(InitList->getEndLoc())` gives the same value :)
https://github.com/llvm/llvm-project/pull/173669
More information about the cfe-commits
mailing list