diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-22 12:08:32 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-22 12:08:32 -0800 |
commit | 01d6b5f51575ff71b085522aeb1283b9c492e132 (patch) | |
tree | 35bb07abc565de8f2a19db142c0260900a144f3f /lib/Target/CppBackend/CPPBackend.cpp | |
parent | cc9745cbc4971f711cf77a2a2d8cb13cea40005c (diff) |
fail on invalid getOpName values
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index dc84f7a207..f41d33ad6c 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -38,8 +38,9 @@ #include <set> using namespace llvm; -#define dump(x, ...) fprintf(stderr, x, __VA_ARGS__) -#define dumpfail(x, ...) { fprintf(stderr, x, __VA_ARGS__); assert(0); } +#define dump(x, ...) fprintf(stderr, x "\n", __VA_ARGS__) +#define dumpfail(x) { fprintf(stderr, x "\n"); report_fatal_error("fail"); } +#define dumpfailv(x, ...) { fprintf(stderr, x "\n", __VA_ARGS__); report_fatal_error("fail"); } #include <Relooper.h> @@ -1038,17 +1039,7 @@ std::string CppWriter::getOpName(const Value* V) { if (I != ForwardRefs.end()) return I->second; - // This is a new forward reference. Generate a unique name for it - std::string result(std::string("fwdref_") + utostr(uniqueNum++)); - - // Yes, this is a hack. An Argument is the smallest instantiable value that - // we can make as a placeholder for the real value. We'll replace these - // Argument instances later. - Out << "Argument* " << result << " = new Argument(" - << getCppName(V->getType()) << ");"; - nl(Out); - ForwardRefs[V] = result; - return result; + dumpfail("invalid value in getOpName"); } static StringRef ConvertAtomicOrdering(AtomicOrdering Ordering) { @@ -1762,7 +1753,7 @@ void CppWriter::printFunctionBody(const Function *F) { const TerminatorInst *TI = BI->getTerminator(); switch (TI->getOpcode()) { default: { - dumpfail("invalid branch instr %s\n", TI->getOpcodeName()); + dumpfailv("invalid branch instr %s\n", TI->getOpcodeName()); break; } case Instruction::Br: { |