This is an archive of the discontinued LLVM Phabricator instance.

[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!
Erik

Diff Detail

Repository
rC Clang

Event Timeline

erik.pilkington marked an inline comment as done.Jan 30 2019, 2:51 PM
erik.pilkington added inline comments.
clang/test/CodeGenObjC/convert-messages-to-runtime-calls.m
43–44 ↗(On Diff #184373)

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...

Fix a mistake in the tests.

pete accepted this revision.Jan 30 2019, 3:02 PM

LGTM. Thanks for fixing this!

This revision is now accepted and ready to land.Jan 30 2019, 3:02 PM
This revision was automatically updated to reflect the committed changes.