Page MenuHomePhabricator

[ObjC] Add compatibility mode for type checking of qualified id block parameters.
ClosedPublic

Authored by vsapsai on Wed, May 6, 11:58 AM.

Details

Summary

Commit 73152a2ec20766ac45673a129bf1f5fc97ca9bbe fixed type checking for
blocks with qualified id parameters. But there are existing APIs in
Apple SDKs relying on the old type checking behavior. Specifically,
these are APIs using NSItemProviderCompletionHandler in
Foundation/NSItemProvider.h. To keep existing code working and to allow
developers to use affected APIs introduce a compatibility mode that
enables the previous type checking. This mode is enabled only on Darwin
platforms.

Diff Detail

Event Timeline

vsapsai created this revision.Wed, May 6, 11:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptWed, May 6, 11:58 AM
jyknight added inline comments.Wed, May 6, 1:04 PM
clang/test/SemaObjC/block-type-safety.m
170

It seems a shame to disallow this assignment in the compatibility mode, when it ought to be allowed.

Perhaps it would be better to allow both directions for parameters when the compatibility flag is set? (That is: the compat mode flag would only cause the compiler to allow _more_ things than it otherwise should.)

vsapsai added inline comments.Wed, May 6, 5:04 PM
clang/test/SemaObjC/block-type-safety.m
170

Hmm, sounds like an interesting idea. It can make the transitioning to the new compiler version less disruptive. Need to think more if it has any undesirable consequences. So far my only objection is that it makes things less consistent. But given the current state of block type checking that argument isn't particularly compelling.

vsapsai updated this revision to Diff 263544.Tue, May 12, 3:38 PM

Make compatibility mode accept correct types per James' Y Knight helpful suggestion.

jyknight accepted this revision.Tue, May 12, 8:47 PM

It looks like you didn't squash your two commits before uploading, so the diff for review now only includes the changes for the comment, not the complete patch. Other than needing to squash the commits, LGTM.

May want to wait for approval from one of the objc reviewers as well though.

This revision is now accepted and ready to land.Tue, May 12, 8:47 PM
vsapsai updated this revision to Diff 263865.Wed, May 13, 2:59 PM

Squash the commits, so that reviewers can review the entire change.

ahatanak accepted this revision.Wed, May 13, 3:32 PM
ahatanak added a subscriber: ahatanak.

LGTM

Thanks everyone for reviews.

This revision was automatically updated to reflect the committed changes.