Improve instantiation control for rtti data and allow key functions to
instantiate a class. WIP. llvm-svn: 89289
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user