Commit fddd26a3 authored by Cristian Cadar's avatar Cristian Cadar Committed by Dan Liew
Browse files

Patch by Dan Liew: " Modified ConstantExpr::toString() to take an

optional radix (base e.g. 2,10,16). This will be needed by the
ExprSMTLIBPrinter that will soon be added."

git-svn-id: 91177308-0d34-0410-b5e6-96231b3b80d8

parent d7210cee
......@@ -408,8 +408,12 @@ public:
return value.getLimitedValue(Limit);
/// toString - Return the constant value as a decimal string.
void toString(std::string &Res) const;
/// toString - Return the constant value as a string
/// \param Res specifies the string for the result to be placed in
/// \param radix specifies the base (e.g. 2,10,16). The default is base 10
void toString(std::string &Res, unsigned radix=10) const;
int compareContents(const Expr &b) const {
const ConstantExpr &cb = static_cast<const ConstantExpr&>(b);
......@@ -430,13 +430,14 @@ llvm::APFloat ConstantExpr::getAPFloatValue(const llvm::fltSemantics &sem) const
return getAPFloatValue(&sem == &APFloat::IEEEquad);
void ConstantExpr::toString(std::string &Res) const {
void ConstantExpr::toString(std::string &Res, unsigned radix) const {
if (IsFloat) {
assert( radix==10 && "Use of non decimal radix for float not supported");
llvm::SmallString<40> S;
Res = S.str();
} else
Res = value.toString(10, false);
Res = value.toString(radix, false);
ref<ConstantExpr> ConstantExpr::Concat(const ref<ConstantExpr> &RHS) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment