summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-01-31 19:07:50 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-01-31 19:07:50 +0000
commit604179775adee4104791d64abbb4b9397f35796b (patch)
tree0877cd0239354a4095311a4bd56591dbd97701da /clang/lib/CodeGen/CGClass.cpp
parentab0ddb57b1f10ccc0d1103bda4242a704810eab2 (diff)
downloadbcm5719-llvm-604179775adee4104791d64abbb4b9397f35796b.tar.gz
bcm5719-llvm-604179775adee4104791d64abbb4b9397f35796b.zip
Simplify EmitMemberInitializer; no intended functionality change.
llvm-svn: 94965
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp20
1 files changed, 1 insertions, 19 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index c965b342986..01b3934c4c0 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -834,24 +834,6 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
FieldType = Field->getType();
}
- // If the field is an array, branch based on the element type.
- const ConstantArrayType *Array =
- CGF.getContext().getAsConstantArrayType(FieldType);
- if (Array)
- FieldType = CGF.getContext().getBaseElementType(FieldType);
-
- // We lose the constructor for anonymous union members, so handle them
- // explicitly.
- // FIXME: This is somwhat ugly, and doesn't seem necessary at all.
- if (MemberInit->getAnonUnionMember() && FieldType->getAs<RecordType>()) {
- if (MemberInit->getInit())
- CGF.EmitAggExpr(MemberInit->getInit(), LHS.getAddress(),
- LHS.isVolatileQualified());
- else
- CGF.EmitAggregateClear(LHS.getAddress(), Field->getType());
- return;
- }
-
// FIXME: If there's no initializer and the CXXBaseOrMemberInitializer
// was implicitly generated, we shouldn't be zeroing memory.
RValue RHS;
@@ -859,7 +841,7 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
RHS = CGF.EmitReferenceBindingToExpr(MemberInit->getInit(), FieldType,
/*IsInitializer=*/true);
CGF.EmitStoreThroughLValue(RHS, LHS, FieldType);
- } else if (Array && !MemberInit->getInit()) {
+ } else if (FieldType->isArrayType() && !MemberInit->getInit()) {
CGF.EmitMemSetToZero(LHS.getAddress(), Field->getType());
} else if (!CGF.hasAggregateLLVMType(Field->getType())) {
RHS = RValue::get(CGF.EmitScalarExpr(MemberInit->getInit(), true));
OpenPOWER on IntegriCloud