File tree Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -8454,6 +8454,11 @@ class AccessorDecl final : public FuncDecl {
84548454 // / even when it does not have one _yet_.
84558455 bool doesAccessorHaveBody () const ;
84568456
8457+ // / Whether this accessor is a protocol requirement for which a default
8458+ // / implementation must be provided for back-deployment. For example, read2
8459+ // / and modify2 requirements with early enough availability.
8460+ bool isRequirementWithSynthesizedDefaultImplementation () const ;
8461+
84578462 static bool classof (const Decl *D) {
84588463 return D->getKind () == DeclKind::Accessor;
84598464 }
Original file line number Diff line number Diff line change @@ -10540,24 +10540,29 @@ ArrayRef<VarDecl *> AccessorDecl::getAccessedProperties() const {
1054010540 return {};
1054110541}
1054210542
10543+ bool AccessorDecl::isRequirementWithSynthesizedDefaultImplementation () const {
10544+ if (!isa<ProtocolDecl>(getDeclContext ()))
10545+ return false ;
10546+
10547+ if (!getASTContext ().LangOpts .hasFeature (Feature::CoroutineAccessors)) {
10548+ return false ;
10549+ }
10550+ if (!requiresFeatureCoroutineAccessors (getAccessorKind ())) {
10551+ return false ;
10552+ }
10553+ if (getStorage ()->getOverrideLoc ()) {
10554+ return false ;
10555+ }
10556+ return getStorage ()->requiresCorrespondingUnderscoredCoroutineAccessor (
10557+ getAccessorKind (), this );
10558+ }
10559+
1054310560bool AccessorDecl::doesAccessorHaveBody () const {
1054410561 auto *accessor = this ;
1054510562 auto *storage = accessor->getStorage ();
1054610563
1054710564 if (isa<ProtocolDecl>(accessor->getDeclContext ())) {
10548- if (!accessor->getASTContext ().LangOpts .hasFeature (
10549- Feature::CoroutineAccessors)) {
10550- return false ;
10551- }
10552- if (!requiresFeatureCoroutineAccessors (accessor->getAccessorKind ())) {
10553- return false ;
10554- }
10555- if (storage->getOverrideLoc ()) {
10556- return false ;
10557- }
10558- return accessor->getStorage ()
10559- ->requiresCorrespondingUnderscoredCoroutineAccessor (
10560- accessor->getAccessorKind (), accessor);
10565+ return isRequirementWithSynthesizedDefaultImplementation ();
1056110566 }
1056210567
1056310568 // NSManaged getters and setters don't have bodies.
You can’t perform that action at this time.
0 commit comments