[CodeGen][ObjC] Make block copy/dispose helper functions exception-safe.
authorAkira Hatanaka <ahatanaka@apple.com>
Thu, 26 Jul 2018 16:51:21 +0000 (16:51 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Thu, 26 Jul 2018 16:51:21 +0000 (16:51 +0000)
commitcb6a933c9bd010f06b0ae50893afb3f821bd5fe0
treea8d4d01d376436d9211d8ae6d7c213b42770854b
parent6fcc7d703b571f456f662a0be1ec6f449d55fdb9
[CodeGen][ObjC] Make block copy/dispose helper functions exception-safe.

When an exception is thrown in a block copy helper function, captured
objects that have previously been copied should be destructed or
released. Similarly, captured objects that are yet to be released should
be released when an exception is thrown in a dispose helper function.

rdar://problem/42410255

Differential Revision: https://reviews.llvm.org/D49718

llvm-svn: 338041
clang/lib/CodeGen/CGBlocks.cpp
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/CodeGenObjC/blocks.m
clang/test/CodeGenObjCXX/arc-blocks.mm