[PATCH] D17275: [TableGen] more helpful error message in MapTableEmitter
Nicolai Hähnle via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 15 13:43:44 PST 2016
nhaehnle created this revision.
nhaehnle added reviewers: spop, stoklund.
nhaehnle added a subscriber: llvm-commits.
nhaehnle set the repository for this revision to rL LLVM.
This should speak for itself. I found it useful in tracking down a confusing error in .td files.
Repository:
rL LLVM
http://reviews.llvm.org/D17275
Files:
utils/TableGen/CodeGenMapTable.cpp
Index: utils/TableGen/CodeGenMapTable.cpp
===================================================================
--- utils/TableGen/CodeGenMapTable.cpp
+++ utils/TableGen/CodeGenMapTable.cpp
@@ -337,10 +337,20 @@
}
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->getAsUnquotedString();
+ }
+
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;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17275.48008.patch
Type: text/x-patch
Size: 984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160215/d604842b/attachment.bin>
More information about the llvm-commits
mailing list