[llvm] 8821345 - [TextAPI] Use const-ref iterator in for-range loop. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 17 04:12:41 PDT 2021


Author: Simon Pilgrim
Date: 2021-09-17T12:11:53+01:00
New Revision: 8821345e68b2e027ababb5f4e1dba6916825681d

URL: https://github.com/llvm/llvm-project/commit/8821345e68b2e027ababb5f4e1dba6916825681d
DIFF: https://github.com/llvm/llvm-project/commit/8821345e68b2e027ababb5f4e1dba6916825681d.diff

LOG: [TextAPI] Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

Added: 
    

Modified: 
    llvm/include/llvm/TextAPI/InterfaceFile.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/TextAPI/InterfaceFile.h b/llvm/include/llvm/TextAPI/InterfaceFile.h
index 596876b7339e..03a541454e1a 100644
--- a/llvm/include/llvm/TextAPI/InterfaceFile.h
+++ b/llvm/include/llvm/TextAPI/InterfaceFile.h
@@ -445,7 +445,7 @@ bool operator==(const DenseMapBase<DerivedT, SymbolsMapKey, MachO::Symbol *,
                                    KeyInfoT, BucketT> &RHS) {
   if (LHS.size() != RHS.size())
     return false;
-  for (auto KV : LHS) {
+  for (const auto &KV : LHS) {
     auto I = RHS.find(KV.first);
     if (I == RHS.end() || *I->second != *KV.second)
       return false;


        


More information about the llvm-commits mailing list