aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/CodeEmitterGen.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-07-29 23:00:08 +0000
committerChris Lattner <sabre@nondot.org>2003-07-29 23:00:08 +0000
commit30709543d2463948d2b6e30a4411a29940cfde69 (patch)
tree10f7b1a546b89586f507066c3a39f5d50b25f335 /utils/TableGen/CodeEmitterGen.cpp
parent92aa8ca9c5e749a010c33baff633343a48dcfec1 (diff)
downloadexternal_llvm-30709543d2463948d2b6e30a4411a29940cfde69.zip
external_llvm-30709543d2463948d2b6e30a4411a29940cfde69.tar.gz
external_llvm-30709543d2463948d2b6e30a4411a29940cfde69.tar.bz2
Don't crash if there is no Inst class in the tablegen file!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeEmitterGen.cpp')
-rw-r--r--utils/TableGen/CodeEmitterGen.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp
index 90497cc..8805c7c 100644
--- a/utils/TableGen/CodeEmitterGen.cpp
+++ b/utils/TableGen/CodeEmitterGen.cpp
@@ -2,7 +2,7 @@
#include "Record.h"
#include "CodeEmitterGen.h"
-void CodeEmitterGen::createEmitter(std::ostream &o) {
+int CodeEmitterGen::createEmitter(std::ostream &o) {
std::vector<Record*> Insts;
const std::map<std::string, Record*> &Defs = Records.getDefs();
@@ -31,8 +31,12 @@ void CodeEmitterGen::createEmitter(std::ostream &o) {
<< " DEBUG(std::cerr << \"Emitting " << R->getName() << "\\n\");\n";
const RecordVal *InstVal = R->getValue("Inst");
- Init *InitVal = InstVal->getValue();
+ if (!InstVal) {
+ std::cerr << "No 'Inst' record found in target description file!\n";
+ return 1;
+ }
+ Init *InitVal = InstVal->getValue();
assert(dynamic_cast<BitsInit*>(InitVal) &&
"Can only handle undefined bits<> types!");
BitsInit *BI = (BitsInit*)InitVal;
@@ -225,4 +229,5 @@ void CodeEmitterGen::createEmitter(std::ostream &o) {
<< " }\n"
<< " return Value;\n"
<< "}\n";
+ return 0;
}