[clang-tools-extra] [clang-tidy] Add new check `modernize-use-structured-binding` (PR #158462)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 23 06:03:33 PST 2025


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/UseStructuredBindingCheck.cpp clang-tools-extra/clang-tidy/modernize/UseStructuredBindingCheck.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/UseStructuredBindingCheck.cpp:45:3: warning: variable 'N' of type 'size_t' (aka 'unsigned long') can be declared 'const' [misc-const-correctness]
   45 |   size_t N = InnerMatchers.size();
      |   ^
      |          const 
clang-tools-extra/clang-tidy/modernize/UseStructuredBindingCheck.cpp:351:5: warning: variable 'ReplacementText' of type 'std::string' (aka 'basic_string<char>') can be declared 'const' [misc-const-correctness]
  351 |     std::string ReplacementText =
      |     ^
      |                 const
```

</details>


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


More information about the cfe-commits mailing list