[llvm-commits] [llvm] r53958 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp
Dan Gohman
gohman at apple.com
Wed Jul 23 11:41:03 PDT 2008
Author: djg
Date: Wed Jul 23 13:41:03 2008
New Revision: 53958
URL: http://llvm.org/viewvc/llvm-project?rev=53958&view=rev
Log:
Use C99 aggregate literal syntax for first-class struct and array values.
This fixes several recent CBE regressions.
Modified:
llvm/trunk/lib/Target/CBackend/CBackend.cpp
Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=53958&r1=53957&r2=53958&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Jul 23 13:41:03 2008
@@ -1021,6 +1021,10 @@
}
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 @@
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 << '{';
More information about the llvm-commits
mailing list