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

llvm-svn: 18974
This commit is contained in:
Chris Lattner 2004-12-15 23:13:15 +00:00
parent e56242780c
commit 298a7f8d8b
1 changed files with 1 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) + "]");
}