Work-in-progess rewrite of thunks: move thunk generation outside of vtable

generation, and make sure we generate thunks when the function is defined
rather than when the vtable is defined.

llvm-svn: 90722
This commit is contained in:
Eli Friedman
2009-12-06 22:01:30 +00:00
parent 94bb5e8d75
commit 8174f2c23c
6 changed files with 185 additions and 11 deletions

View File

@@ -621,8 +621,13 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
Context.getSourceManager(),
"Generating code for declaration");
if (isa<CXXMethodDecl>(D))
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
getVtableInfo().MaybeEmitVtable(GD);
if (MD->isVirtual() && MD->isOutOfLine() &&
(!isa<CXXDestructorDecl>(D) || GD.getDtorType() != Dtor_Base)) {
BuildThunksForVirtual(GD);
}
}
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(D))
EmitCXXConstructor(CD, GD.getCtorType());