summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2016-07-01 21:08:47 +0000
committerTim Shen <timshen91@gmail.com>2016-07-01 21:08:47 +0000
commit421119fd891cc68d76f28bd0d9afa78e222e3a04 (patch)
tree302448290d3e873dde526799aa6ea76c20f0e689 /clang/lib/CodeGen/CGDecl.cpp
parent1bba89612b1a03bf3f35455e2ae1e2fb3af7849a (diff)
downloadbcm5719-llvm-421119fd891cc68d76f28bd0d9afa78e222e3a04.tar.gz
bcm5719-llvm-421119fd891cc68d76f28bd0d9afa78e222e3a04.zip
[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/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 508720f5b9a..89407cd70c3 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -529,19 +529,6 @@ namespace {
CGF.EmitCall(FnInfo, CleanupFn, ReturnValueSlot(), Args);
}
};
-
- /// A cleanup to call @llvm.lifetime.end.
- 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);
- }
- };
} // end anonymous namespace
/// EmitAutoVarWithLifetime - Does the setup required for an automatic
@@ -1406,13 +1393,10 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) {
// Make sure we call @llvm.lifetime.end. This needs to happen
// *last*, so the cleanup needs to be pushed *first*.
- if (emission.useLifetimeMarkers()) {
- EHStack.pushCleanup<CallLifetimeEnd>(NormalAndEHCleanup,
+ if (emission.useLifetimeMarkers())
+ EHStack.pushCleanup<CallLifetimeEnd>(NormalEHLifetimeMarker,
emission.getAllocatedAddress(),
emission.getSizeForLifetimeMarkers());
- EHCleanupScope &cleanup = cast<EHCleanupScope>(*EHStack.begin());
- cleanup.setLifetimeMarker();
- }
// Check the type for a cleanup.
if (QualType::DestructionKind dtorKind = D.getType().isDestructedType())
OpenPOWER on IntegriCloud