https://github.com/bjope created https://github.com/llvm/llvm-project/pull/215775
As a follow up to commit d4c991d34c8c8568c ([clang-tidy][NFC] Apply const-correctness for auto 1/N (#213839)) we make sure to use a const reference when iterating of FixLocations. As indicated by -Wrange-loop-construct this prevents a copy from type 'std::pair<clang::SourceLocation, bool> const'. From bee3677626cf3573c7ca1360e69ff55e987efd28 Mon Sep 17 00:00:00 2001 From: Bjorn Pettersson <[email protected]> Date: Wed, 12 Aug 2026 13:13:37 +0200 Subject: [PATCH] [clang-tidy] Fix a -Wrange-loop-construct warning As a follow up to commit d4c991d34c8c8568c ([clang-tidy][NFC] Apply const-correctness for auto 1/N (#213839)) we make sure to use a const reference when iterating of FixLocations. As indicated by -Wrange-loop-construct this prevents a copy from type 'std::pair<clang::SourceLocation, bool> const'. --- clang-tools-extra/clang-tidy/ClangTidy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp index 32e18645880e1..8135826ef660d 100644 --- a/clang-tools-extra/clang-tidy/ClangTidy.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp @@ -188,7 +188,7 @@ class ErrorReporter { } reportFix(Diag, Error.Message.Fix); } - for (const auto Fix : FixLocations) { + for (const auto &Fix : FixLocations) { Diags.Report(Fix.first, Fix.second ? diag::note_fixit_applied : diag::note_fixit_failed); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
