aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r--lib/Target/CBackend/CBackend.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index cda81e428d..8340374750 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/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 << '{';