[llvm] cec5296 - [TableGen] Use `const auto&` instead of `auto` to avoid copy (#113053)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 09:52:50 PST 2024


Author: abhishek-kaushik22
Date: 2024-11-21T18:52:47+01:00
New Revision: cec52960fdc8eeecab340ffe4cd12f8a8c43bd3b

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

LOG: [TableGen] Use `const auto&` instead of `auto` to avoid copy (#113053)

Added: 
    

Modified: 
    llvm/utils/TableGen/InstrDocsEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/InstrDocsEmitter.cpp b/llvm/utils/TableGen/InstrDocsEmitter.cpp
index 5f22fb417198bc..54ca7d8ae40da4 100644
--- a/llvm/utils/TableGen/InstrDocsEmitter.cpp
+++ b/llvm/utils/TableGen/InstrDocsEmitter.cpp
@@ -159,7 +159,7 @@ static void EmitInstrDocs(const RecordKeeper &RK, raw_ostream &OS) {
     // Operands.
     for (unsigned i = 0; i < II->Operands.size(); ++i) {
       bool IsDef = i < II->Operands.NumDefs;
-      auto Op = II->Operands[i];
+      const auto &Op = II->Operands[i];
 
       if (Op.MINumOperands > 1) {
         // This operand corresponds to multiple operands on the


        


More information about the llvm-commits mailing list