diff options
author | Tim Shen <timshen91@gmail.com> | 2016-07-01 21:08:47 +0000 |
---|---|---|
committer | Tim Shen <timshen91@gmail.com> | 2016-07-01 21:08:47 +0000 |
commit | 421119fd891cc68d76f28bd0d9afa78e222e3a04 (patch) | |
tree | 302448290d3e873dde526799aa6ea76c20f0e689 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 1bba89612b1a03bf3f35455e2ae1e2fb3af7849a (diff) | |
download | llvm-421119fd891cc68d76f28bd0d9afa78e222e3a04.zip llvm-421119fd891cc68d76f28bd0d9afa78e222e3a04.tar.gz llvm-421119fd891cc68d76f28bd0d9afa78e222e3a04.tar.bz2 |
[Temporary, Lifetime] Add lifetime marks for temporaries
With all MaterializeTemporaryExprs coming with a ExprWithCleanups, it's
easy to add correct lifetime.end marks into the right RunCleanupsScope.
Differential Revision: http://reviews.llvm.org/D20499
llvm-svn: 274385
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 441cee54f..9d46ff2 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -302,6 +302,19 @@ public: llvm::Instruction *CurrentFuncletPad = nullptr; + class CallLifetimeEnd final : public EHScopeStack::Cleanup { + llvm::Value *Addr; + llvm::Value *Size; + + public: + CallLifetimeEnd(Address addr, llvm::Value *size) + : Addr(addr.getPointer()), Size(size) {} + + void Emit(CodeGenFunction &CGF, Flags flags) override { + CGF.EmitLifetimeEnd(Size, Addr); + } + }; + /// Header for data within LifetimeExtendedCleanupStack. struct LifetimeExtendedCleanupHeader { /// The size of the following cleanup object. |