init = BuildVtablePtr(vtbl, VtblClass, RD, Offset);
else {
init = CGM.getVtableInfo().getCtorVtable(Class, Base, BaseOffset);
- subvtbl = dyn_cast<llvm::Constant>(init->getOperand(0));
+
+ subvtbl = init;
subVtblClass = Base;
+
+ init = BuildVtablePtr(init, Class, Base, BaseOffset);
}
Inits.push_back(init);
}
VtblClass = Class;
} else {
init = CGM.getVtableInfo().getCtorVtable(Class, RD, Offset);
+ init = BuildVtablePtr(init, RD, RD, Offset);
+
VtblClass = RD;
}
llvm::Constant *vtbl = dyn_cast<llvm::Constant>(init->getOperand(0));
VirtualVTTs(Base);
}
}
+
public:
VTTBuilder(std::vector<llvm::Constant *> &inits, const CXXRecordDecl *c,
CodeGenModule &cgm)
llvm::Constant *CGVtableInfo::getCtorVtable(const CXXRecordDecl *LayoutClass,
const CXXRecordDecl *RD,
uint64_t Offset) {
- return CGM.GenerateVtable(LayoutClass, RD, Offset);
+ llvm::Constant *Vtable = CGM.GenerateVtable(LayoutClass, RD, Offset);
+
+ return cast<llvm::Constant>(Vtable->getOperand(0));
}
void CGVtableInfo::MaybeEmitVtable(GlobalDecl GD) {