diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-26 20:35:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-26 20:35:54 +0000 |
commit | c9a85f9b4cc8ed95ed7feeff554a74bf52bdc1f7 (patch) | |
tree | 0ced1efed2cdfebc0e0217632689a23e7565fa73 /lib/CodeGen/CGDeclCXX.cpp | |
parent | f9b9eab747e911ded499924b2616d8712d65efce (diff) |
emit dtors with the right calling convention in -fno-use-cxa-atexit
mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGDeclCXX.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index 40c18ca3c2..f6c805fdca 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/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(); } |