1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

Use C99 aggregate literal syntax for first-class struct and array values.

This fixes several recent CBE regressions.

llvm-svn: 53958
This commit is contained in:
Dan Gohman 2008-07-23 18:41:03 +00:00
parent 3b775c0d28
commit 8d04607133

View File

@ -1021,6 +1021,10 @@ void CWriter::printConstant(Constant *CPV) {
}
case Type::ArrayTyID:
// Use C99 compound expression literal initializer syntax.
Out << "(";
printType(Out, CPV->getType());
Out << ")";
Out << "{ "; // Arrays are wrapped in struct types.
if (ConstantArray *CA = dyn_cast<ConstantArray>(CPV)) {
printConstantArray(CA);
@ -1064,6 +1068,10 @@ void CWriter::printConstant(Constant *CPV) {
break;
case Type::StructTyID:
// Use C99 compound expression literal initializer syntax.
Out << "(";
printType(Out, CPV->getType());
Out << ")";
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
const StructType *ST = cast<StructType>(CPV->getType());
Out << '{';