summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-26 20:35:54 +0000
committerChris Lattner <sabre@nondot.org>2010-04-26 20:35:54 +0000
commit5e8416a77fe2127c6ac22a3003dacb896cf2b166 (patch)
treeba53f6f2bced0c5b122993ebc748dd2390bee687 /clang/lib/CodeGen
parentb2a709be07fb92ce3df9355f64028796412f4c41 (diff)
downloadbcm5719-llvm-5e8416a77fe2127c6ac22a3003dacb896cf2b166.tar.gz
bcm5719-llvm-5e8416a77fe2127c6ac22a3003dacb896cf2b166.zip
emit dtors with the right calling convention in -fno-use-cxa-atexit
mode. llvm-svn: 102377
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDeclCXX.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 40c18ca3c2a..f6c805fdcaa 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -219,9 +219,14 @@ void CodeGenFunction::GenerateCXXGlobalDtorFunc(llvm::Function *Fn,
SourceLocation());
// Emit the dtors, in reverse order from construction.
- for (unsigned i = 0, e = DtorsAndObjects.size(); i != e; ++i)
- Builder.CreateCall(DtorsAndObjects[e - i - 1].first,
- DtorsAndObjects[e - i - 1].second);
+ for (unsigned i = 0, e = DtorsAndObjects.size(); i != e; ++i) {
+ llvm::Constant *Callee = DtorsAndObjects[e - i - 1].first;
+ llvm::CallInst *CI = Builder.CreateCall(Callee,
+ DtorsAndObjects[e - i - 1].second);
+ // Make sure the call and the callee agree on calling convention.
+ if (llvm::Function *F = dyn_cast<llvm::Function>(Callee))
+ CI->setCallingConv(F->getCallingConv());
+ }
FinishFunction();
}
OpenPOWER on IntegriCloud