[clang-tools-extra] [clang-tidy] Add modernize-default-arg-braced-init check (PR #203474)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 12 01:04:10 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE LINT COMMENT: clang-tidy-->


:warning: C/C++ code linter, clang-tidy found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

```bash

git diff -U0 origin/main...HEAD -- clang-tools-extra/clang-tidy/modernize/DefaultArgBracedInitCheck.cpp clang-tools-extra/clang-tidy/modernize/DefaultArgBracedInitCheck.h clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp |
python3 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py   -path build -p1 -quiet
```

</details>

<details>
<summary>
View the output from clang-tidy here.
</summary>

```

clang-tools-extra/clang-tidy/modernize/DefaultArgBracedInitCheck.cpp:36:3: warning: variable 'Loc' of type 'SourceLocation' can be declared 'const' [misc-const-correctness]
   36 |   SourceLocation Loc = Ctor->getExprLoc();
      |   ^
      |                  const 
clang-tools-extra/clang-tidy/modernize/DefaultArgBracedInitCheck.cpp:41:3: warning: variable 'ParamType' of type 'QualType' can be declared 'const' [misc-const-correctness]
   41 |   QualType ParamType = Param->getType()
      |   ^
      |            const 
clang-tools-extra/clang-tidy/modernize/DefaultArgBracedInitCheck.cpp:46:3: warning: variable 'CtorType' of type 'QualType' can be declared 'const' [misc-const-correctness]
   46 |   QualType CtorType = Ctor->getType()
      |   ^
      |            const 
clang-tools-extra/clang-tidy/modernize/DefaultArgBracedInitCheck.cpp:55:3: warning: variable 'Range' of type 'CharSourceRange' can be declared 'const' [misc-const-correctness]
   55 |   CharSourceRange Range =
      |   ^
      |                   const
```

</details>


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


More information about the cfe-commits mailing list