[CodeGen][ObjC] Emit invoke instead of call to call `objc_release` when
authorAkira Hatanaka <ahatanaka@apple.com>
Fri, 10 May 2019 21:54:16 +0000 (21:54 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Fri, 10 May 2019 21:54:16 +0000 (21:54 +0000)
commit34d28cf25f38aa220d0b43d70ab430ec693252fa
tree6e8e459f5dbfdb6f408ac38a46f36b5fa22e79d8
parent7eb6b5ffc3c7c2a5c988dad209671bdaff452cc4
[CodeGen][ObjC] Emit invoke instead of call to call `objc_release` when
necessary.

Prior to r349952, clang used to call objc_msgSend when sending a release
messages, emitting an invoke instruction instead of a call instruction
when it was necessary to catch an exception. That changed in r349952
because runtime function objc_release is called as a nounwind function,
which broke programs that were overriding the dealloc method and
throwing an exception from it. This patch restores the behavior prior to
r349952.

rdar://problem/50253394

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

llvm-svn: 360474
clang/lib/CodeGen/CGObjC.cpp
clang/test/CodeGenObjC/convert-messages-to-runtime-calls.m