Fix PR485, instead of emitting zero sized arrays, emit arrays of size 1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18974 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-12-15 23:13:15 +00:00
parent 00e8930206
commit 3e3b6f7a46
2 changed files with 2 additions and 0 deletions

View File

@ -338,6 +338,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
unsigned NumElements = ATy->getNumElements();
if (NumElements == 0) NumElements = 1;
return printType(Out, ATy->getElementType(),
NameSoFar + "[" + utostr(NumElements) + "]");
}

View File

@ -338,6 +338,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
unsigned NumElements = ATy->getNumElements();
if (NumElements == 0) NumElements = 1;
return printType(Out, ATy->getElementType(),
NameSoFar + "[" + utostr(NumElements) + "]");
}