Move EmitCtorPrologue to CGCXX. Add an assert and FIXMEs.

llvm-svn: 76498
This commit is contained in:
Fariborz Jahanian
2009-07-20 23:18:55 +00:00
parent 834e2f69da
commit 83381cc9a6
2 changed files with 33 additions and 33 deletions

View File

@@ -141,39 +141,6 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
Ptr->eraseFromParent();
}
/// EmitCtorPrologue - This routine generates necessary code to initialize
/// base classes and non-static data members belonging to this constructor.
void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD) {
for (CXXConstructorDecl::init_const_iterator B = CD->init_begin(),
E = CD->init_end();
B != E; ++B) {
CXXBaseOrMemberInitializer *Member = (*B);
if (Member->isBaseInitializer()) {
// FIXME. Added base initialilzers here.
;
}
else {
// non-static data member initilaizers.
FieldDecl *Field = Member->getMember();
QualType FieldType = getContext().getCanonicalType((Field)->getType());
assert(!getContext().getAsArrayType(FieldType)
&& "Field arrays initialization unsupported");
assert(!FieldType->getAsRecordType()
&& "Field class initialization unsupported");
llvm::Value *LoadOfThis = LoadCXXThis();
LValue LHS = EmitLValueForField(LoadOfThis, Field, false, 0);
assert(Member->getNumArgs() == 1 && "Initializer count must be 1 only");
Expr *RhsExpr = *Member->begin();
llvm::Value *RHS = EmitScalarExpr(RhsExpr, true);
if (LHS.isBitfield())
EmitStoreThroughBitfieldLValue(RValue::get(RHS), LHS, FieldType, 0);
else
EmitStoreThroughLValue(RValue::get(RHS), LHS, FieldType);
}
}
}
void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy,
llvm::Function *Fn,
const FunctionArgList &Args,