Better Error Reporting
authorDavid Greene <greened@obbligato.org>
Mon, 19 Sep 2011 18:26:07 +0000 (18:26 +0000)
committerDavid Greene <greened@obbligato.org>
Mon, 19 Sep 2011 18:26:07 +0000 (18:26 +0000)
Report missing template arguments more helpfully by supplying the name
of the missing argument in the error message.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140034 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/TGParser.cpp

index 36e9b82ff3f5c546dc676d9c8c75588a68b29c17..f734b984e18b8560bf59628c6e4705bff7376268 100644 (file)
@@ -1416,6 +1416,10 @@ std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec,
   if (ArgsRec != 0 && EltTy == 0) {
     const std::vector<std::string> &TArgs = ArgsRec->getTemplateArgs();
     const RecordVal *RV = ArgsRec->getValue(TArgs[ArgN]);
+    if (!RV) {
+      errs() << "Cannot find template arg " << ArgN << " (" << TArgs[ArgN]
+        << ")\n";
+    }
     assert(RV && "Template argument record not found??");
     ItemType = RV->getType();
     ++ArgN;