[llvm] 0168da3 - [TableGen] CodeGenMapTable - use for-range loop. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 10:55:45 PDT 2021


Author: Simon Pilgrim
Date: 2021-04-16T18:55:23+01:00
New Revision: 0168da3035feef569518c12e3f3733c1eec25395

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

LOG: [TableGen] CodeGenMapTable - use for-range loop. NFCI.

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenMapTable.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenMapTable.cpp b/llvm/utils/TableGen/CodeGenMapTable.cpp
index 289a20a96f02..6f718acbac3e 100644
--- a/llvm/utils/TableGen/CodeGenMapTable.cpp
+++ b/llvm/utils/TableGen/CodeGenMapTable.cpp
@@ -318,11 +318,10 @@ Record *MapTableEmitter::getInstrForColumn(Record *KeyInstr,
   ListInit *ColFields = InstrMapDesc.getColFields();
   Record *MatchInstr = nullptr;
 
-  for (unsigned i = 0, e = RelatedInstrVec.size(); i < e; i++) {
+  for (llvm::Record *CurInstr : RelatedInstrVec) {
     bool MatchFound = true;
-    Record *CurInstr = RelatedInstrVec[i];
     for (unsigned j = 0, endCF = ColFields->size();
-        (j < endCF) && MatchFound; j++) {
+         (j < endCF) && MatchFound; j++) {
       Init *ColFieldJ = ColFields->getElement(j);
       Init *CurInstrInit = CurInstr->getValue(ColFieldJ)->getValue();
       std::string CurInstrVal = CurInstrInit->getAsUnquotedString();
@@ -342,8 +341,9 @@ Record *MapTableEmitter::getInstrForColumn(Record *KeyInstr,
         }
 
         PrintFatalError("Multiple matches found for `" + KeyInstr->getName() +
-              "', for the relation `" + InstrMapDesc.getName() + "', row fields [" +
-              KeyValueStr + "], column `" + CurValueCol->getAsString() + "'");
+                        "', for the relation `" + InstrMapDesc.getName() +
+                        "', row fields [" + KeyValueStr + "], column `" +
+                        CurValueCol->getAsString() + "'");
       }
       MatchInstr = CurInstr;
     }


        


More information about the llvm-commits mailing list