summaryrefslogtreecommitdiff
path: root/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-05-06 18:47:45 +0000
committerJim Grosbach <grosbach@apple.com>2011-05-06 18:47:45 +0000
commit5d754bfa320c558cbebded328454b75134f2cfee (patch)
treeeccb38603ba8bf732499f67f06e3ddbc7400236b /utils/TableGen/Record.cpp
parent96883ec7002890b949e369cc6e0a5043c110a462 (diff)
downloadllvm-5d754bfa320c558cbebded328454b75134f2cfee.tar.gz
llvm-5d754bfa320c558cbebded328454b75134f2cfee.tar.bz2
llvm-5d754bfa320c558cbebded328454b75134f2cfee.tar.xz
Improve diagnostics for some parse errors. Not asserting when a user input
error is detected is a good thing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131005 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r--utils/TableGen/Record.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index abbbafed09..c427b761d8 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -583,9 +583,7 @@ Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) {
if (Record *D = (CurRec->getRecords()).getDef(Name))
return new DefInit(D);
- errs() << "Variable not defined: '" + Name + "'\n";
- assert(0 && "Variable not found");
- return 0;
+ throw TGError(CurRec->getLoc(), "Undefined reference:'" + Name + "'\n");
}
}
break;
@@ -813,15 +811,13 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
OpInit *RHSo = dynamic_cast<OpInit*>(RHS);
if (!RHSo) {
- errs() << "!foreach requires an operator\n";
- assert(0 && "No operator for !foreach");
+ throw TGError(CurRec->getLoc(), "!foreach requires an operator\n");
}
TypedInit *LHSt = dynamic_cast<TypedInit*>(LHS);
if (!LHSt) {
- errs() << "!foreach requires typed variable\n";
- assert(0 && "No typed variable for !foreach");
+ throw TGError(CurRec->getLoc(), "!foreach requires typed variable\n");
}
if ((MHSd && DagType) || (MHSl && ListType)) {