From 8174f2c23ce005c53b0ac2885cb2e967de1aafbb Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sun, 6 Dec 2009 22:01:30 +0000 Subject: 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 --- clang/lib/CodeGen/CodeGenModule.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 8fb03b2d19c4..5f822f509f81 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -621,8 +621,13 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) { Context.getSourceManager(), "Generating code for declaration"); - if (isa(D)) + if (const CXXMethodDecl *MD = dyn_cast(D)) { getVtableInfo().MaybeEmitVtable(GD); + if (MD->isVirtual() && MD->isOutOfLine() && + (!isa(D) || GD.getDtorType() != Dtor_Base)) { + BuildThunksForVirtual(GD); + } + } if (const CXXConstructorDecl *CD = dyn_cast(D)) EmitCXXConstructor(CD, GD.getCtorType()); -- cgit v1.2.3