about summary refs log tree commit diff homepage
path: root/lib/Expr
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2014-12-13 16:01:36 +0000
committerDan Liew <daniel.liew@imperial.ac.uk>2014-12-13 16:01:36 +0000
commit381de54fc6b9a73bb296ec92198f7789c457e818 (patch)
tree626a70dbab6d54e71fd32612ac9b796a0c0f0eca /lib/Expr
parent92ae53041ef2e0a89b90a4128d3fed280e4427cf (diff)
downloadklee-381de54fc6b9a73bb296ec92198f7789c457e818.tar.gz
Clean up some ExprSMTLIBPrinter code by using llvm_unreachable
Diffstat (limited to 'lib/Expr')
-rw-r--r--lib/Expr/ExprSMTLIBPrinter.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Expr/ExprSMTLIBPrinter.cpp b/lib/Expr/ExprSMTLIBPrinter.cpp
index 9db6f328..d93411bf 100644
--- a/lib/Expr/ExprSMTLIBPrinter.cpp
+++ b/lib/Expr/ExprSMTLIBPrinter.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "klee/util/ExprSMTLIBPrinter.h"
 
 #include <stack>
@@ -159,8 +160,7 @@ void ExprSMTLIBPrinter::printConstant(const ref<ConstantExpr> &e) {
     break;
 
   default:
-    llvm::errs() << "ExprSMTLIBPrinter::printConstant() : Unexpected Constant "
-                    "display mode\n";
+    llvm_unreachable("Unexpected constant display mode");
   }
 }
 
@@ -429,7 +429,7 @@ const char *ExprSMTLIBPrinter::getSMTLIBKeyword(const ref<Expr> &e) {
     return "bvsge";
 
   default:
-    return "<error>";
+    llvm_unreachable("Conversion from Expr to SMTLIB keyword failed");
   }
 }
 
@@ -653,11 +653,7 @@ void ExprSMTLIBPrinter::printAction() {
 }
 
 void ExprSMTLIBPrinter::scan(const ref<Expr> &e) {
-  if (e.isNull()) {
-    llvm::errs() << "ExprSMTLIBPrinter::scan() : Found NULL expression!"
-                 << "\n";
-    return;
-  }
+  assert(!(e.isNull()) && "found NULL expression");
 
   if (isa<ConstantExpr>(e))
     return; // we don't need to scan simple constants
@@ -974,7 +970,7 @@ void ExprSMTLIBPrinter::printCastToSort(const ref<Expr> &e,
 
   } break;
   default:
-    assert(0 && "Unsupported cast!");
+    llvm_unreachable("Unsupported cast");
   }
 }
 
@@ -1045,7 +1041,7 @@ void ExprSMTLIBPrinter::printLogicalOrBitVectorExpr(
     *p << ((s == SORT_BITVECTOR) ? "bvxor" : "xor");
     break;
   default:
-    *p << "ERROR"; // this shouldn't happen
+    llvm_unreachable("Conversion from Expr to SMTLIB keyword failed");
   }
   *p << " ";