summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-05-06 17:27:27 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-05-06 17:27:27 +0000
commit49a94b1c7cf661b1d45247ef39e70c7330219045 (patch)
tree422ba891ab463a187a8b8d6ba8292e29db578255 /clang/lib/CodeGen/CodeGenModule.cpp
parentaab77fe5749d48bd8ca8556e8954319505c3fc44 (diff)
downloadbcm5719-llvm-49a94b1c7cf661b1d45247ef39e70c7330219045.tar.gz
bcm5719-llvm-49a94b1c7cf661b1d45247ef39e70c7330219045.zip
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 4bf1e3ad3e5..96aa725f56f 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -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);
OpenPOWER on IntegriCloud