diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-01-20 20:02:39 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-01-20 20:02:39 +0000 |
commit | 91f5a3f253a3d7282923e690cc47cbc8710a7928 (patch) | |
tree | 23c4fd3a41e4ed24f3bb312282e5b454ecf31d62 /llvm/lib/TableGen | |
parent | 88685f2865ef9636cb865f4018a84e51231f75f9 (diff) | |
download | bcm5719-llvm-91f5a3f253a3d7282923e690cc47cbc8710a7928.tar.gz bcm5719-llvm-91f5a3f253a3d7282923e690cc47cbc8710a7928.zip |
TblGen diagnostic for mismatched template instantiation.
Providing a template argment to a non-templatized class was crashing
tblgen. Add a diagnostic.
For example,
$ cat bug.td
class A;
def B : A<0> {
}
$ llvm-tblgen bug.td
bug.td:3:11: error: template argument provided to non-template class
def B : A<0> {
^
llvm-svn: 148565
Diffstat (limited to 'llvm/lib/TableGen')
-rw-r--r-- | llvm/lib/TableGen/TGParser.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index 81c68292f1b..9ed7ebbb6bd 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/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] |