Author: Björn Pettersson
Date: 2026-08-12T11:32:23Z
New Revision: 68f0da5431dec2de8aed7ca0e54792c98cb110c4

URL: 
https://github.com/llvm/llvm-project/commit/68f0da5431dec2de8aed7ca0e54792c98cb110c4
DIFF: 
https://github.com/llvm/llvm-project/commit/68f0da5431dec2de8aed7ca0e54792c98cb110c4.diff

LOG: [clang-tidy] Fix a -Wrange-loop-construct warning (#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'.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/ClangTidy.cpp

Removed: 
    


################################################################################
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

Reply via email to