diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-11-27 22:09:22 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-11-27 22:09:22 +0000 |
commit | 86811609d9353e3aed198045d56e790eb3b6118c (patch) | |
tree | 09aef0ba4fd83dd274b0e587f7a5a69e0a070354 /lib/CodeGen/CGTemporaries.cpp | |
parent | 53ac3d88f9089affe6c5a93dc31d45a4a6f77447 (diff) |
When destroying temporaries, instead of a custom cleanup use the
generic pushDestroy function.
This would reduce the number of useful declarations in
CGTemporaries.cpp to one. Since CodeGenFunction::EmitCXXTemporary
does not deserve its own file, move it to CGCleanup.cpp and delete
CGTemporaries.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145202 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGTemporaries.cpp')
-rw-r--r-- | lib/CodeGen/CGTemporaries.cpp | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/CodeGen/CGTemporaries.cpp b/lib/CodeGen/CGTemporaries.cpp deleted file mode 100644 index 7e9ff91a92..0000000000 --- a/lib/CodeGen/CGTemporaries.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===--- CGTemporaries.cpp - Emit LLVM Code for C++ temporaries -----------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This contains code dealing with C++ code generation of temporaries -// -//===----------------------------------------------------------------------===// - -#include "CodeGenFunction.h" -using namespace clang; -using namespace CodeGen; - -namespace { - struct DestroyTemporary : EHScopeStack::Cleanup { - const CXXDestructorDecl *dtor; - llvm::Value *addr; - DestroyTemporary(const CXXDestructorDecl *dtor, llvm::Value *addr) - : dtor(dtor), addr(addr) {} - void Emit(CodeGenFunction &CGF, Flags flags) { - CGF.EmitCXXDestructorCall(dtor, Dtor_Complete, /*ForVirtualBase=*/false, - addr); - } - }; -} - -/// Emits all the code to cause the given temporary to be cleaned up. -void CodeGenFunction::EmitCXXTemporary(const CXXTemporary *Temporary, - llvm::Value *Ptr) { - pushFullExprCleanup<DestroyTemporary>(NormalAndEHCleanup, - Temporary->getDestructor(), - Ptr); -} |