[llvm-commits] [llvm] r131005 - /llvm/trunk/utils/TableGen/Record.cpp
Jim Grosbach
grosbach at apple.com
Fri May 6 11:47:45 PDT 2011
Author: grosbach
Date: Fri May 6 13:47:45 2011
New Revision: 131005
URL: http://llvm.org/viewvc/llvm-project?rev=131005&view=rev
Log:
Improve diagnostics for some parse errors. Not asserting when a user input
error is detected is a good thing.
Modified:
llvm/trunk/utils/TableGen/Record.cpp
Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=131005&r1=131004&r2=131005&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Fri May 6 13:47:45 2011
@@ -583,9 +583,7 @@
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 @@
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)) {
More information about the llvm-commits
mailing list