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 | b1320cb38158aedd5b59e0e3649ce5d1e90c9776 (patch) | |
tree | a21b4a6ef484473cec7cace330f9cd11fecae910 /lib/TableGen/TGParser.cpp | |
parent | 6d56730ab8a08a3530a029e9b681590d88b00bc0 (diff) | |
download | llvm-b1320cb38158aedd5b59e0e3649ce5d1e90c9776.tar.gz llvm-b1320cb38158aedd5b59e0e3649ce5d1e90c9776.tar.bz2 llvm-b1320cb38158aedd5b59e0e3649ce5d1e90c9776.tar.xz |
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> {
^
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/TableGen/TGParser.cpp')
-rw-r--r-- | lib/TableGen/TGParser.cpp | 4 |
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] |