Fix coredump for when an ID is used illegally outside a record

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7411 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-07-30 05:17:35 +00:00
parent bfce056ea8
commit 18226e0cf1
2 changed files with 8 additions and 0 deletions

View File

@ -245,6 +245,10 @@ Value : INTVAL {
$$ = Init;
delete $2;
} | ID {
if (CurRec == 0) {
err() << "Def/Class name '" << *$1 << "' not allowed here!\n";
abort();
}
if (const RecordVal *RV = CurRec->getValue(*$1)) {
$$ = new VarInit(*$1, RV->getType());
} else if (Record *D = Records.getDef(*$1)) {

View File

@ -245,6 +245,10 @@ Value : INTVAL {
$$ = Init;
delete $2;
} | ID {
if (CurRec == 0) {
err() << "Def/Class name '" << *$1 << "' not allowed here!\n";
abort();
}
if (const RecordVal *RV = CurRec->getValue(*$1)) {
$$ = new VarInit(*$1, RV->getType());
} else if (Record *D = Records.getDef(*$1)) {