[cfe-commits] r94965 - /cfe/trunk/lib/CodeGen/CGClass.cpp
Eli Friedman
eli.friedman at gmail.com
Sun Jan 31 11:07:50 PST 2010
Author: efriedma
Date: Sun Jan 31 13:07:50 2010
New Revision: 94965
URL: http://llvm.org/viewvc/llvm-project?rev=94965&view=rev
Log:
Simplify EmitMemberInitializer; no intended functionality change.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=94965&r1=94964&r2=94965&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sun Jan 31 13:07:50 2010
@@ -834,24 +834,6 @@
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 @@
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));
More information about the cfe-commits
mailing list