This is an archive of the discontinued LLVM Phabricator instance.

[ObjC] Add a command line flag that disables recognition of objc_direct for testability
ClosedPublic

Authored by erik.pilkington on Feb 1 2021, 7:54 PM.

Details

Summary

Programmers would like to be able to test direct methods by calling them from a different linkage unit or mocking them, both of which are impossible. This patch adds a flag that effectively disables the attribute, which will fix this when enabled in testable builds.

rdar://71190891

Diff Detail

Event Timeline

erik.pilkington created this revision.Feb 1 2021, 7:54 PM
erik.pilkington requested review of this revision.Feb 1 2021, 7:54 PM
arphaman added inline comments.Feb 2 2021, 9:02 AM
clang/include/clang/Driver/Options.td
2141

Do you need to use the new options marshaling infrastructure?

jansvoboda11 added inline comments.Feb 19 2021, 5:15 AM
  • Use the new marshaling infrastructure
  • Fix a few places in Sema where we manually checked for ObjCDirectAttr instead of using isDirectMethod
arphaman accepted this revision.Apr 5 2021, 3:08 PM
This revision is now accepted and ready to land.Apr 5 2021, 3:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2021, 8:18 AM