[clang-tools-extra] [clang-tidy] Validate macro expansions before enum conversion (PR #244989)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 21 19:52:10 PST 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/MacroToEnumCheck.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/MacroToEnumCheck.cpp:447:3: warning: variable 'Candidate' of type 'iterator' (aka 'DenseMapIterator<const clang::MacroInfo *, unsigned int, llvm::DenseMapInfo<const clang::MacroInfo *, void>, llvm::detail::DenseMapPair<const clang::MacroInfo *, unsigned int>>') can be declared 'const' [misc-const-correctness]
447 | auto Candidate = UnmatchedExpansions.find(Info);
| ^
| const
clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:509:5: warning: variable 'Expansion' of type 'iterator' (aka 'DenseMapIterator<clang::SourceLocation, clang::tidy::modernize::(anonymous namespace)::MacroExpansion, llvm::DenseMapInfo<clang::SourceLocation, void>, llvm::detail::DenseMapPair<clang::SourceLocation, clang::tidy::modernize::(anonymous namespace)::MacroExpansion>>') can be declared 'const' [misc-const-correctness]
509 | auto Expansion = Expansions.find(ExpansionBegin);
| ^
| const
clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:512:7: warning: variable 'Candidate' of type 'iterator' (aka 'DenseMapIterator<const clang::MacroInfo *, unsigned int, llvm::DenseMapInfo<const clang::MacroInfo *, void>, llvm::detail::DenseMapPair<const clang::MacroInfo *, unsigned int>>') can be declared 'const' [misc-const-correctness]
512 | auto Candidate = UnmatchedExpansions.find(Expansion->second.Info);
| ^
| const
```
</details>
https://github.com/llvm/llvm-project/pull/244989
More information about the cfe-commits
mailing list