TableGen: Convert an assert() to a proper diagnostic.
authorJim Grosbach <grosbach@apple.com>
Wed, 12 Sep 2012 17:40:25 +0000 (17:40 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 12 Sep 2012 17:40:25 +0000 (17:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163726 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmMatcherEmitter.cpp

index 78eb6418993383b245c3a12388b9e4d42d8527bb..fcd32dc8716fef36e92436316527a3c5aa0cc66a 100644 (file)
@@ -1020,7 +1020,9 @@ AsmMatcherInfo::getOperandClass(Record *Rec, int SubOpIdx) {
     throw TGError(Rec->getLoc(), "register class has no class info!");
   }
 
-  assert(Rec->isSubClassOf("Operand") && "Unexpected operand!");
+  if (!Rec->isSubClassOf("Operand"))
+    throw TGError(Rec->getLoc(), "Operand `" + Rec->getName() +
+                  "' does not derive from class Operand!\n");
   Record *MatchClass = Rec->getValueAsDef("ParserMatchClass");
   if (ClassInfo *CI = AsmOperandClasses[MatchClass])
     return CI;