Improve diagnostics for some parse errors. Not asserting when a user input

error is detected is a good thing.

llvm-svn: 131005
This commit is contained in:
Jim Grosbach 2011-05-06 18:47:45 +00:00
parent 763ac0397e
commit 59ddb73d47
1 changed files with 3 additions and 7 deletions

View File

@ -583,9 +583,7 @@ Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) {
if (Record *D = (CurRec->getRecords()).getDef(Name)) if (Record *D = (CurRec->getRecords()).getDef(Name))
return new DefInit(D); return new DefInit(D);
errs() << "Variable not defined: '" + Name + "'\n"; throw TGError(CurRec->getLoc(), "Undefined reference:'" + Name + "'\n");
assert(0 && "Variable not found");
return 0;
} }
} }
break; break;
@ -813,15 +811,13 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
OpInit *RHSo = dynamic_cast<OpInit*>(RHS); OpInit *RHSo = dynamic_cast<OpInit*>(RHS);
if (!RHSo) { if (!RHSo) {
errs() << "!foreach requires an operator\n"; throw TGError(CurRec->getLoc(), "!foreach requires an operator\n");
assert(0 && "No operator for !foreach");
} }
TypedInit *LHSt = dynamic_cast<TypedInit*>(LHS); TypedInit *LHSt = dynamic_cast<TypedInit*>(LHS);
if (!LHSt) { if (!LHSt) {
errs() << "!foreach requires typed variable\n"; throw TGError(CurRec->getLoc(), "!foreach requires typed variable\n");
assert(0 && "No typed variable for !foreach");
} }
if ((MHSd && DagType) || (MHSl && ListType)) { if ((MHSd && DagType) || (MHSl && ListType)) {