[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 17 11:06:55 PDT 2018
ahatanak updated this revision to Diff 142792.
ahatanak added a comment.
Deactivate the cleanups for callee-destructed parameters that are being forwarded to a delegated constructor.
I also added a new member (CurrentCleanupStackDepth) to CodeGenFunction that tracks the stack depth of the most recent RunCleanupsScope. This is needed to prevent popping the cleanup at the top of the stack in DeactivateCleanupBlock if the cleanup doesn't belong to the current RunCleanupsScope. Without this, the current RunCleanupsScope's CleanupStackDepth can point to a cleanup that doesn't exist on the stack anymore (CleanupStackDepth.encloses(EHStack.stable_begin()) doesn't hold true anymore), which can cause CodeGenFunction::PopCleanupBlocks to pop all the cleanups before it hits the bottom of the stack and crash.
Repository:
rC Clang
https://reviews.llvm.org/D45382
Files:
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGCleanup.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CodeGenFunction.h
test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
test/CodeGenObjCXX/arc-special-member-functions.mm
test/CodeGenObjCXX/lambda-expressions.mm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45382.142792.patch
Type: text/x-patch
Size: 9674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180417/3564c050/attachment.bin>
More information about the cfe-commits
mailing list