about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-22 03:21:02 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-22 03:21:02 +0000
commita99507bc04f2c16e6de118795a63a074899df66b (patch)
tree34e4b92522d482155a98619b5918a19dabb3de77 /lib
parent2ec4358c44e21fd43fa78d933dca7fbc55f0a908 (diff)
downloadklee-a99507bc04f2c16e6de118795a63a074899df66b.tar.gz
Add ConstantExpr::toString (instead of using getConstantValue()).
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Expr/Expr.cpp9
-rw-r--r--lib/Expr/ExprPPrinter.cpp8
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index b6833f24..a89163f2 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -9,7 +9,6 @@
 
 #include "klee/Expr.h"
 
-
 #include "klee/Machine.h"
 #include "llvm/Type.h"
 #include "llvm/DerivedTypes.h"
@@ -21,6 +20,8 @@
 
 #include "klee/util/ExprPPrinter.h"
 
+#include <sstream>
+
 using namespace klee;
 using namespace llvm;
 
@@ -345,6 +346,12 @@ void ConstantExpr::toMemory(void *address) {
   }
 }
 
+void ConstantExpr::toString(std::string &Res) const {
+  std::stringstream os;
+  os << *this;
+  Res = os.str();
+}
+
 ref<ConstantExpr> ConstantExpr::Concat(const ref<ConstantExpr> &RHS) {
   Expr::Width W = getWidth() + RHS->getWidth();
   assert(W <= 64 && "FIXME: Support arbitrary bit-widths!");
diff --git a/lib/Expr/ExprPPrinter.cpp b/lib/Expr/ExprPPrinter.cpp
index a2103b99..6eb15c7c 100644
--- a/lib/Expr/ExprPPrinter.cpp
+++ b/lib/Expr/ExprPPrinter.cpp
@@ -382,7 +382,13 @@ public:
       if (printWidth)
 	PC << "(w" << e->getWidth() << " ";
 
-      PC << e->getConstantValue();
+      if (e->getWidth() <= 64) {
+        PC << e->getZExtValue();
+      } else {
+        std::string S;
+        e->toString(S);
+        PC << S;
+      }
 
       if (printWidth)
 	PC << ")";