aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/TableGen/TGParser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/TableGen/TGParser.cpp b/lib/TableGen/TGParser.cpp
index 81c68292f1..9ed7ebbb6b 100644
--- a/lib/TableGen/TGParser.cpp
+++ b/lib/TableGen/TGParser.cpp
@@ -1516,6 +1516,10 @@ std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec,
unsigned int ArgN = 0;
if (ArgsRec != 0 && EltTy == 0) {
const std::vector<Init *> &TArgs = ArgsRec->getTemplateArgs();
+ if (!TArgs.size()) {
+ TokError("template argument provided to non-template class");
+ return std::vector<Init*>();
+ }
const RecordVal *RV = ArgsRec->getValue(TArgs[ArgN]);
if (!RV) {
errs() << "Cannot find template arg " << ArgN << " (" << TArgs[ArgN]