objc_alloc and objc_allocWithZone may throw exceptions if the underlying method does. If we're in a @try block, then make sure we emit an invoke instead of a call.
Fixes rdar://47610407
Thanks for taking a look!
Erik
Paths
| Differential D57476
[CodeGenObjC] Use an invoke instead of a call when calling `objc_alloc` or `objc_allocWithZone` ClosedPublic Authored by erik.pilkington on Jan 30 2019, 2:40 PM.
Details
Summary objc_alloc and objc_allocWithZone may throw exceptions if the underlying method does. If we're in a @try block, then make sure we emit an invoke instead of a call. Fixes rdar://47610407 Thanks for taking a look!
Diff Detail Event Timelineerik.pilkington added inline comments.
This revision is now accepted and ready to land.Jan 30 2019, 3:02 PM Closed by commit rC352687: [CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZone (authored by epilk). · Explain WhyJan 30 2019, 3:17 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 184373 clang/lib/CodeGen/CGObjC.cpp
clang/test/CodeGenObjC/convert-messages-to-runtime-calls.m
|
er, these should be invokes too. Looks like this was just happening to work out because the SSA value was named %call in asserts mode. Updating the diff...