[llvm] r263148 - [TableGen] more helpful error message in MapTableEmitter

Nicolai Haehnle via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 10:51:59 PST 2016


Author: nha
Date: Thu Mar 10 12:51:58 2016
New Revision: 263148

URL: http://llvm.org/viewvc/llvm-project?rev=263148&view=rev
Log:
[TableGen] more helpful error message in MapTableEmitter

Differential Revision: http://reviews.llvm.org/D17275

Modified:
    llvm/trunk/utils/TableGen/CodeGenMapTable.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenMapTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenMapTable.cpp?rev=263148&r1=263147&r2=263148&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenMapTable.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenMapTable.cpp Thu Mar 10 12:51:58 2016
@@ -337,10 +337,20 @@ Record *MapTableEmitter::getInstrForColu
     }
 
     if (MatchFound) {
-      if (MatchInstr) // Already had a match
+      if (MatchInstr) {
+        // Already had a match
         // Error if multiple matches are found for a column.
+        std::string KeyValueStr;
+        for (Init *Value : KeyValue) {
+          if (!KeyValueStr.empty())
+            KeyValueStr += ", ";
+          KeyValueStr += Value->getAsString();
+        }
+
         PrintFatalError("Multiple matches found for `" + KeyInstr->getName() +
-              "', for the relation `" + InstrMapDesc.getName());
+              "', for the relation `" + InstrMapDesc.getName() + "', row fields [" +
+              KeyValueStr + "], column `" + CurValueCol->getAsString() + "'");
+      }
       MatchInstr = CurInstr;
     }
   }




More information about the llvm-commits mailing list