Add an implementation of thunks for varargs methods. The implementation is a bit messy, but it is correct as long as the method in question doesn't use indirect gotos. A couple of possible alternative implementations are outlined in FIXME's in this patch. rdar://problem/8077308 .
llvm-svn: 130993
This commit is contained in:
@@ -793,14 +793,19 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
|
||||
return;
|
||||
|
||||
if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
|
||||
// Make sure to emit the definition(s) before we emit the thunks.
|
||||
// This is necessary for the generation of certain thunks.
|
||||
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(Method))
|
||||
EmitCXXConstructor(CD, GD.getCtorType());
|
||||
else if (const CXXDestructorDecl *DD =dyn_cast<CXXDestructorDecl>(Method))
|
||||
EmitCXXDestructor(DD, GD.getDtorType());
|
||||
else
|
||||
EmitGlobalFunctionDefinition(GD);
|
||||
|
||||
if (Method->isVirtual())
|
||||
getVTables().EmitThunks(GD);
|
||||
|
||||
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(Method))
|
||||
return EmitCXXConstructor(CD, GD.getCtorType());
|
||||
|
||||
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(Method))
|
||||
return EmitCXXDestructor(DD, GD.getDtorType());
|
||||
return;
|
||||
}
|
||||
|
||||
return EmitGlobalFunctionDefinition(GD);
|
||||
|
||||
Reference in New Issue
Block a user