[clang-tools-extra] [clang-tidy][NFC] Apply const-correctness for auto 1/N (PR #213839)
Björn Pettersson via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 12 00:00:38 PDT 2026
================
@@ -187,7 +188,7 @@ class ErrorReporter {
}
reportFix(Diag, Error.Message.Fix);
}
- for (auto Fix : FixLocations) {
+ for (const auto Fix : FixLocations) {
----------------
bjope wrote:
I see this:
```
.../llvm/llvm-dev-cov/clang-tools-extra/clang-tidy/ClangTidy.cpp:191:21: error: loop variable 'Fix' creates a copy from type 'std::pair<clang::SourceLocation, bool> const' [-Werror,-Wrange-loop-construct]
for (const auto Fix : FixLocations) {
^
.../llvm/llvm-dev-cov/clang-tools-extra/clang-tidy/ClangTidy.cpp:191:10: note: use reference type 'std::pair<clang::SourceLocation, bool> const &' to prevent copying
for (const auto Fix : FixLocations) {
^~~~~~~~~~~~~~~~
&
```
(Although I've only seen it when building with clang 15 as we seem to still use that in some of our old build bots....)
https://github.com/llvm/llvm-project/pull/213839
More information about the cfe-commits
mailing list