GenericValue GV = EE->runFunction(FibF, Args);
// import result of execution
- std::cout << "Result: " << GV.IntVal.toString(10) << "\n";
+ std::cout << "Result: " << GV.IntVal.toStringUnsigned(10) << "\n";
return 0;
}
GenericValue gv = EE->runFunction(FooF, noargs);
// Import result of execution:
- std::cout << "Result: " << gv.IntVal.toString(10) << "\n";
+ std::cout << "Result: " << gv.IntVal.toStringUnsigned(10) << "\n";
return 0;
}
/// radix given. The radix can be 2, 8, 10 or 16.
/// @returns a character interpretation of the APInt
/// @brief Convert unsigned APInt to string representation.
- inline std::string toString(uint8_t radix = 10) const {
+ inline std::string toStringUnsigned(uint8_t radix = 10) const {
return toString(radix, false);
}
void setIsUnsigned(bool Val) { IsUnsigned = Val; }
void setIsSigned(bool Val) { IsUnsigned = !Val; }
+ /// This is used internally to convert an APInt to a string.
+ /// @brief Converts an APInt to a std::string
+ std::string toString(uint8_t Radix) const {
+ return toString(Radix, isSigned());
+ }
+
const APSInt &operator%=(const APSInt &RHS) {
assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
case Type::DoubleTyID: DOUT << "double " << Val.DoubleVal; break;
case Type::PointerTyID: DOUT << "void* " << intptr_t(Val.PointerVal); break;
case Type::IntegerTyID:
- DOUT << "i" << Val.IntVal.getBitWidth() << " " << Val.IntVal.toString(10)
- << " (0x" << Val.IntVal.toString(16) << ")\n";
+ DOUT << "i" << Val.IntVal.getBitWidth() << " "
+ << Val.IntVal.toStringUnsigned(10)
+ << " (0x" << Val.IntVal.toStringUnsigned(16) << ")\n";
break;
}
}
else for (unsigned i = getNumWords(); i > 0; i--) {
cerr << pVal[i-1] << " ";
}
- cerr << " U(" << this->toString(10) << ") S(" << this->toStringSigned(10)
- << ")\n" << std::setbase(10);
+ cerr << " U(" << this->toStringUnsigned(10) << ") S("
+ << this->toStringSigned(10) << ")\n" << std::setbase(10);
}
#endif
std::string NewName = I->getName();
for (unsigned i = 0, e = Operands.size(); i != e; ++i)
if (ConstantInt *CI = dyn_cast<ConstantInt>(Operands[i]))
- NewName += "." + CI->getValue().toString(10);
+ NewName += "." + CI->getValue().toStringUnsigned(10);
else
NewName += ".x";
TheArg->setName(NewName+".val");