[clang-tools-extra] [clang-tidy] comment braced-init list arguments (PR #180408)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 12 08:49:30 PST 2026


vbvictor wrote:

> The check’s goal is to clarify ambiguous arguments, and braced-init arguments are among the least self-describing forms at the call site. Since users already opt in to literal-commenting via existing options, adding another switch increases configuration surface without a strong use case. Making this behavior unconditional seems aligned with the check’s intent and keeps configuration simpler.

>From reading docs, the check main idea is to detect mismatched comments, like:
```cpp
void f(Foo foo);

...

f(/*bar=*/ {}); // warning!
```
But not to add new comments unconditionally. 

With your current behavoir, you _always_ add comments which is not the aligned behavoir (because every other `Comment` option is off-by-default)

Looking at this, we should provide two new options: `CommentAnonymousInitLists` `CommentTypedInitLists`.
Last option is still needed because it's very opionated if explicitly spelled type is enought to omit comment or not.



https://github.com/llvm/llvm-project/pull/180408


More information about the cfe-commits mailing list