[llvm-commits] [llvm] r74443 - /llvm/trunk/utils/TableGen/TGParser.cpp
David Greene
greened at obbligato.org
Mon Jun 29 12:59:53 PDT 2009
Author: greened
Date: Mon Jun 29 14:59:52 2009
New Revision: 74443
URL: http://llvm.org/viewvc/llvm-project?rev=74443&view=rev
Log:
Improve TableGen error reporting.
Modified:
llvm/trunk/utils/TableGen/TGParser.cpp
Modified: llvm/trunk/utils/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=74443&r1=74442&r2=74443&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.cpp (original)
+++ llvm/trunk/utils/TableGen/TGParser.cpp Mon Jun 29 14:59:52 2009
@@ -1395,7 +1395,7 @@
std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec, RecTy *EltTy) {
std::vector<Init*> Result;
RecTy *ItemType = EltTy;
- int ArgN = 0;
+ unsigned int ArgN = 0;
if (ArgsRec != 0 && EltTy == 0) {
const std::vector<std::string> &TArgs = ArgsRec->getTemplateArgs();
const RecordVal *RV = ArgsRec->getValue(TArgs[ArgN]);
@@ -1411,6 +1411,10 @@
if (ArgsRec != 0 && EltTy == 0) {
const std::vector<std::string> &TArgs = ArgsRec->getTemplateArgs();
+ if (ArgN >= TArgs.size()) {
+ TokError("too many template arguments");
+ return std::vector<Init*>();
+ }
const RecordVal *RV = ArgsRec->getValue(TArgs[ArgN]);
assert(RV && "Template argument record not found??");
ItemType = RV->getType();
More information about the llvm-commits
mailing list