Oops, didn't handle hex values correctly. :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-10-15 00:05:03 +00:00
parent c5bdb247e4
commit 6bb46cdf27

View File

@ -168,7 +168,7 @@ string ConstPoolArray::getStrValue() const {
//
const Type *ETy = cast<ArrayType>(getType())->getElementType();
bool isString = (ETy == Type::SByteTy || ETy == Type::UByteTy);
for (unsigned i = 0; i < Operands.size(); i++)
for (unsigned i = 0; i < Operands.size(); ++i)
if (ETy == Type::SByteTy &&
cast<ConstPoolSInt>(Operands[i])->getValue() < 0) {
isString = false;
@ -177,7 +177,7 @@ string ConstPoolArray::getStrValue() const {
if (isString) {
Result = "c\"";
for (unsigned i = 0; i < Operands.size(); i++) {
for (unsigned i = 0; i < Operands.size(); ++i) {
unsigned char C = (ETy == Type::SByteTy) ?
(unsigned char)cast<ConstPoolSInt>(Operands[i])->getValue() :
(unsigned char)cast<ConstPoolUInt>(Operands[i])->getValue();
@ -186,8 +186,8 @@ string ConstPoolArray::getStrValue() const {
Result += C;
} else {
Result += '\\';
Result += (C/16)+'0';
Result += (C&15)+'0';
Result += ( C/16 < 10) ? ( C/16 +'0') : ( C/16 -10+'A');
Result += ((C&15) < 10) ? ((C&15)+'0') : ((C&15)-10+'A');
}
}
Result += "\"";