diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-23 18:41:03 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-23 18:41:03 +0000 |
commit | 1a24539405bb1adb7198c8ebafc6cd82218c604b (patch) | |
tree | 97d77105f53bc63d13b3894a737e2ed303b80155 /lib/Target/CBackend/CBackend.cpp | |
parent | 92e87f23791851efb8f6a13c29bffe48f2850527 (diff) |
Use C99 aggregate literal syntax for first-class struct and array values.
This fixes several recent CBE regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 8 |
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 << '{'; |