diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-24 17:57:02 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-24 17:57:02 +0000 |
commit | 50b8eea3f36881a988a5757e0f6e15d45900324b (patch) | |
tree | daade6f88c26f5af02717e677016f036d6dd9c26 /lib/CodeGen/CGCXX.cpp | |
parent | f242b1b0c4e998911cb96b2ba7e27ab4a5abaed3 (diff) |
More work toward initialization of objects
in constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 4a2db05532..2349171ae7 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -432,13 +432,22 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD) { QualType FieldType = getContext().getCanonicalType((Field)->getType()); assert(!getContext().getAsArrayType(FieldType) && "FIXME. Field arrays initialization unsupported"); - assert(!FieldType->getAsRecordType() - && "FIXME. Field class initialization unsupported"); + llvm::Value *LoadOfThis = LoadCXXThis(); LValue LHS = EmitLValueForField(LoadOfThis, Field, false, 0); + if (FieldType->getAsRecordType()) { + + assert(Member->getConstructor() && + "EmitCtorPrologue - no constructor to initialize member"); + EmitCXXConstructorCall(Member->getConstructor(), + Ctor_Complete, LHS.getAddress(), + Member->const_arg_begin(), + Member->const_arg_end()); + continue; + } assert(Member->getNumArgs() == 1 && "Initializer count must be 1 only"); - Expr *RhsExpr = *Member->begin(); + Expr *RhsExpr = *Member->arg_begin(); llvm::Value *RHS = EmitScalarExpr(RhsExpr, true); if (LHS.isBitfield()) EmitStoreThroughBitfieldLValue(RValue::get(RHS), LHS, FieldType, 0); |