aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-06-29 19:59:52 +0000
committerDavid Greene <greened@obbligato.org>2009-06-29 19:59:52 +0000
commit67acdf2977595a1d9755bf919d678f80ee65364f (patch)
tree2f0494048ae5a4e571bc02564a44faaa0c4ee844 /utils/TableGen
parent48de5d8fd0afc4e09fa4f790b74c97a463944ef9 (diff)
downloadexternal_llvm-67acdf2977595a1d9755bf919d678f80ee65364f.zip
external_llvm-67acdf2977595a1d9755bf919d678f80ee65364f.tar.gz
external_llvm-67acdf2977595a1d9755bf919d678f80ee65364f.tar.bz2
Improve TableGen error reporting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74443 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/TGParser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/TableGen/TGParser.cpp b/utils/TableGen/TGParser.cpp
index 28ebdb5..1109def 100644
--- a/utils/TableGen/TGParser.cpp
+++ b/utils/TableGen/TGParser.cpp
@@ -1395,7 +1395,7 @@ TGParser::ParseDagArgList(Record *CurRec) {
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 @@ std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec, Rec
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();