[PATCH] D102459: [clang][ObjC] Allow different availability annotation on a method when implementing an optional protocol requirement

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 13 20:54:10 PDT 2021


arphaman created this revision.
arphaman added a reviewer: erik.pilkington.
Herald added subscribers: ributzka, jfb.
Herald added a reviewer: aaron.ballman.
arphaman requested review of this revision.

When an Objective-C method implements an optional protocol requirement,
allow the method to use a newer introduced or older deprecated / obsoleted
availability version than what's specified on the method in the protocol itself. 
This allows SDK adopters to adopt an optional method from a
protocol later than when the method is introduced in the protocol. The users
that call an optional method on an object that conforms to this protocol
are supposed to check whether the object implements the method or not,
so a lack of appropriate `if (@available)` check for a new OS version
is not a cause of concern as there's already another runtime check that's required.


https://reviews.llvm.org/D102459

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/SemaObjC/attr-availability.m
  clang/test/SemaObjC/override-opt-prop-availability.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102459.345343.patch
Type: text/x-patch
Size: 7282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210514/250616bf/attachment-0001.bin>


More information about the cfe-commits mailing list