Improve instantiation control for rtti data and allow key functions to

instantiate a class.  WIP.

llvm-svn: 89289
This commit is contained in:
Mike Stump
2009-11-19 01:08:19 +00:00
parent 46fffee081
commit 1a139f8fb5
4 changed files with 96 additions and 31 deletions

View File

@@ -616,6 +616,16 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
Context.getSourceManager(),
"Generating code for declaration");
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
const CXXRecordDecl *RD = MD->getParent();
// We have to convert it to have a record layout.
Types.ConvertTagDeclType(RD);
const CGRecordLayout &CGLayout = Types.getCGRecordLayout(RD);
// A definition of a KeyFunction, generates all the class data, such
// as vtable, rtti and the VTT.
if (CGLayout.getKeyFunction() == MD)
getVtableInfo().GenerateClassData(RD);
}
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(D))
EmitCXXConstructor(CD, GD.getCtorType());
else if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(D))