[llvm-commits] [llvm] r148565 - /llvm/trunk/lib/TableGen/TGParser.cpp
Jim Grosbach
grosbach at apple.com
Fri Jan 20 12:02:39 PST 2012
Author: grosbach
Date: Fri Jan 20 14:02:39 2012
New Revision: 148565
URL: http://llvm.org/viewvc/llvm-project?rev=148565&view=rev
Log:
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> {
^
Modified:
llvm/trunk/lib/TableGen/TGParser.cpp
Modified: llvm/trunk/lib/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=148565&r1=148564&r2=148565&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp (original)
+++ llvm/trunk/lib/TableGen/TGParser.cpp Fri Jan 20 14:02:39 2012
@@ -1516,6 +1516,10 @@
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]
More information about the llvm-commits
mailing list