summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-06 00:13:11 +0000
committerChris Lattner <sabre@nondot.org>2010-09-06 00:13:11 +0000
commit52bcf96384c1feaed7b9d5890093fbdf862673c8 (patch)
tree21b47394ccd61e10cfd4901477107068a32f76f6 /clang/lib/CodeGen/CGExprAgg.cpp
parentf53c096813441896d7a7e3bec2546a8ddfad2d78 (diff)
downloadbcm5719-llvm-52bcf96384c1feaed7b9d5890093fbdf862673c8.tar.gz
bcm5719-llvm-52bcf96384c1feaed7b9d5890093fbdf862673c8.zip
move the hackaround for PR6537 to catch unions as well,
fixing the ICE in PR7151 llvm-svn: 113130
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 19d2fac7693..f1bc692cf40 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -581,8 +581,17 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) {
// the optimizer, especially with bitfields.
unsigned NumInitElements = E->getNumInits();
RecordDecl *SD = E->getType()->getAs<RecordType>()->getDecl();
- unsigned CurInitVal = 0;
-
+
+ // If we're initializing the whole aggregate, just do it in place.
+ // FIXME: This is a hack around an AST bug (PR6537).
+ if (NumInitElements == 1 && E->getType() == E->getInit(0)->getType()) {
+ EmitInitializationToLValue(E->getInit(0),
+ CGF.MakeAddrLValue(DestPtr, E->getType()),
+ E->getType());
+ return;
+ }
+
+
if (E->getType()->isUnionType()) {
// Only initialize one field of a union. The field itself is
// specified by the initializer list.
@@ -614,19 +623,10 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) {
return;
}
-
- // If we're initializing the whole aggregate, just do it in place.
- // FIXME: This is a hack around an AST bug (PR6537).
- if (NumInitElements == 1 && E->getType() == E->getInit(0)->getType()) {
- EmitInitializationToLValue(E->getInit(0),
- CGF.MakeAddrLValue(DestPtr, E->getType()),
- E->getType());
- return;
- }
-
// Here we iterate over the fields; this makes it simpler to both
// default-initialize fields and skip over unnamed fields.
+ unsigned CurInitVal = 0;
for (RecordDecl::field_iterator Field = SD->field_begin(),
FieldEnd = SD->field_end();
Field != FieldEnd; ++Field) {
OpenPOWER on IntegriCloud