From a99507bc04f2c16e6de118795a63a074899df66b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 22 Jun 2009 03:21:02 +0000 Subject: Add ConstantExpr::toString (instead of using getConstantValue()). git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73870 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Expr/Expr.cpp | 9 ++++++++- lib/Expr/ExprPPrinter.cpp | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'lib/Expr') 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 + 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::Concat(const ref &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 << ")"; -- cgit 1.4.1