Simplify some code.

llvm-svn: 90670
This commit is contained in:
Anders Carlsson 2009-12-05 18:38:15 +00:00
parent 35f5646ef0
commit 5a1a84f9fa
1 changed files with 11 additions and 11 deletions

View File

@ -1702,18 +1702,18 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD,
PopCXXTemporary();
}
if (!ClassDecl->isDynamicClass())
return;
// Initialize the vtable pointer
if (ClassDecl->isDynamicClass()) {
if (!LoadOfThis)
LoadOfThis = LoadCXXThis();
llvm::Value *VtableField;
llvm::Type *Ptr8Ty, *PtrPtr8Ty;
Ptr8Ty = llvm::PointerType::get(llvm::Type::getInt8Ty(VMContext), 0);
PtrPtr8Ty = llvm::PointerType::get(Ptr8Ty, 0);
VtableField = Builder.CreateBitCast(LoadOfThis, PtrPtr8Ty);
llvm::Value *vtable = CGM.getVtableInfo().getVtable(ClassDecl);
Builder.CreateStore(vtable, VtableField);
}
if (!LoadOfThis)
LoadOfThis = LoadCXXThis();
const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(VMContext);
llvm::Value *VtableField =
Builder.CreateBitCast(LoadOfThis, Int8PtrTy->getPointerTo());
llvm::Value *vtable = CGM.getVtableInfo().getVtable(ClassDecl);
Builder.CreateStore(vtable, VtableField);
}
/// EmitDtorEpilogue - Emit all code that comes at the end of class's