summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-23 18:41:03 +0000
committerDan Gohman <gohman@apple.com>2008-07-23 18:41:03 +0000
commitae187c6ebadd1146a4bdf4a12217e80d45073a23 (patch)
tree66c31dfd4dfedeba9f3565456998ad1b356457a4 /llvm/lib/Target/CBackend/CBackend.cpp
parent46abc7db6be1805fcc7e0e22cc511918e1ba5678 (diff)
downloadbcm5719-llvm-ae187c6ebadd1146a4bdf4a12217e80d45073a23.tar.gz
bcm5719-llvm-ae187c6ebadd1146a4bdf4a12217e80d45073a23.zip
Use C99 aggregate literal syntax for first-class struct and array values.
This fixes several recent CBE regressions. llvm-svn: 53958
Diffstat (limited to 'llvm/lib/Target/CBackend/CBackend.cpp')
-rw-r--r--llvm/lib/Target/CBackend/CBackend.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp
index cda81e428d7..83403747501 100644
--- a/llvm/lib/Target/CBackend/CBackend.cpp
+++ b/llvm/lib/Target/CBackend/CBackend.cpp
@@ -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 << '{';
OpenPOWER on IntegriCloud