Avoid printing out huge structures or arrays if they are just filled with zeros

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6938 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-06-28 20:08:24 +00:00
parent f460048771
commit e9a64ea38e

View File

@ -253,6 +253,11 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
Out << "0x" << utohexstr(*(uint64_t*)Ptr);
} else if (const ConstantArray *CA = dyn_cast<ConstantArray>(CV)) {
if (CA->getNumOperands() > 5 && CA->isNullValue()) {
Out << "zeroinitializer";
return;
}
// As a special case, print the array as a string if it is an array of
// ubytes or an array of sbytes with positive values.
//
@ -300,6 +305,11 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
Out << " ]";
}
} else if (const ConstantStruct *CS = dyn_cast<ConstantStruct>(CV)) {
if (CS->getNumOperands() > 5 && CS->isNullValue()) {
Out << "zeroinitializer";
return;
}
Out << "{";
if (CS->getNumOperands()) {
Out << " ";