@@ -4156,6 +4156,10 @@ void ValueDecl::setIsObjC(bool value) {
41564156}
41574157
41584158Identifier ExtensionDecl::getObjCCategoryName () const {
4159+ auto abiRole = ABIRoleInfo (this );
4160+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
4161+ return abiRole.getCounterpart ()->getObjCCategoryName ();
4162+
41594163 // If there's an @objc attribute, it's authoritative. (ClangImporter
41604164 // attaches one automatically.)
41614165 if (auto objcAttr = getAttrs ().getAttribute <ObjCAttr>(/* AllowInvalid*/ true )) {
@@ -4409,6 +4413,10 @@ StringRef ValueDecl::getCDeclName() const {
44094413 return clangDecl->getName ();
44104414 }
44114415
4416+ auto abiRole = ABIRoleInfo (this );
4417+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
4418+ return abiRole.getCounterpart ()->getCDeclName ();
4419+
44124420 // Handle explicit cdecl attributes.
44134421 if (auto cdeclAttr = getAttrs ().getAttribute <CDeclAttr>()) {
44144422 return cdeclAttr->Name ;
@@ -4447,6 +4455,10 @@ ValueDecl::getObjCRuntimeName(bool skipIsObjCResolution) const {
44474455
44484456std::optional<ObjCSelector>
44494457Decl::getExplicitObjCName (bool allowInvalid) const {
4458+ auto abiRole = ABIRoleInfo (this );
4459+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
4460+ return abiRole.getCounterpart ()->getExplicitObjCName ();
4461+
44504462 auto objcAttr = getAttrs ().getAttribute <ObjCAttr>(allowInvalid);
44514463 if (objcAttr && !objcAttr->isNameImplicit ())
44524464 return objcAttr->getName ();
@@ -5141,6 +5153,10 @@ static bool checkAccessUsingAccessScopes(const DeclContext *useDC,
51415153static bool
51425154isObjCMemberImplementation (const ValueDecl *VD,
51435155 llvm::function_ref<AccessLevel()> getAccessLevel) {
5156+ auto abiRole = ABIRoleInfo (VD);
5157+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
5158+ return isObjCMemberImplementation (abiRole.getCounterpart (), getAccessLevel);
5159+
51445160 if (auto ED = dyn_cast<ExtensionDecl>(VD->getDeclContext ()))
51455161 if (ED->isObjCImplementation () && !isa<TypeDecl>(VD)) {
51465162 auto attrDecl = isa<AccessorDecl>(VD)
@@ -6620,6 +6636,10 @@ static StringRef mangleObjCRuntimeName(const NominalTypeDecl *nominal,
66206636
66216637StringRef ClassDecl::getObjCRuntimeName (
66226638 llvm::SmallVectorImpl<char > &buffer) const {
6639+ auto abiRole = ABIRoleInfo (this );
6640+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
6641+ return abiRole.getCounterpart ()->getObjCRuntimeName (buffer);
6642+
66236643 // If there is a Clang declaration, use it's runtime name.
66246644 if (auto objcClass
66256645 = dyn_cast_or_null<clang::ObjCInterfaceDecl>(getClangDecl ()))
@@ -7128,6 +7148,10 @@ ProtocolDecl::getPrimaryAssociatedTypes() const {
71287148
71297149StringRef ProtocolDecl::getObjCRuntimeName (
71307150 llvm::SmallVectorImpl<char > &buffer) const {
7151+ auto abiRole = ABIRoleInfo (this );
7152+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
7153+ return abiRole.getCounterpart ()->getObjCRuntimeName (buffer);
7154+
71317155 // If there is an 'objc' attribute with a name, use that name.
71327156 if (auto objc = getAttrs ().getAttribute <ObjCAttr>()) {
71337157 if (auto name = objc->getName ())
@@ -7600,6 +7624,10 @@ getNameFromObjcAttribute(const ObjCAttr *attr, DeclName preferredName) {
76007624
76017625ObjCSelector
76027626AbstractStorageDecl::getObjCGetterSelector (Identifier preferredName) const {
7627+ auto abiRole = ABIRoleInfo (this );
7628+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
7629+ return abiRole.getCounterpart ()->getObjCGetterSelector (preferredName);
7630+
76037631 // If the getter has an @objc attribute with a name, use that.
76047632 if (auto getter = getAccessor (AccessorKind::Get)) {
76057633 if (auto name = getNameFromObjcAttribute (getter->getAttrs ().
@@ -7630,6 +7658,10 @@ AbstractStorageDecl::getObjCGetterSelector(Identifier preferredName) const {
76307658
76317659ObjCSelector
76327660AbstractStorageDecl::getObjCSetterSelector (Identifier preferredName) const {
7661+ auto abiRole = ABIRoleInfo (this );
7662+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
7663+ return abiRole.getCounterpart ()->getObjCSetterSelector (preferredName);
7664+
76337665 // If the setter has an @objc attribute with a name, use that.
76347666 auto setter = getAccessor (AccessorKind::Set);
76357667 auto objcAttr = setter ? setter->getAttrs ().getAttribute <ObjCAttr>()
@@ -8617,6 +8649,10 @@ Type VarDecl::getPropertyWrapperInitValueInterfaceType() const {
86178649}
86188650
86198651Identifier VarDecl::getObjCPropertyName () const {
8652+ auto abiRole = ABIRoleInfo (this );
8653+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
8654+ return abiRole.getCounterpart ()->getObjCPropertyName ();
8655+
86208656 if (auto attr = getAttrs ().getAttribute <ObjCAttr>()) {
86218657 if (auto name = attr->getName ())
86228658 return name->getSelectorPieces ()[0 ];
@@ -10221,6 +10257,11 @@ AbstractFunctionDecl::getBodyFingerprintIncludingLocalTypeMembers() const {
1022110257ObjCSelector
1022210258AbstractFunctionDecl::getObjCSelector (DeclName preferredName,
1022310259 bool skipIsObjCResolution) const {
10260+ auto abiRole = ABIRoleInfo (this );
10261+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
10262+ return abiRole.getCounterpart ()->getObjCSelector (preferredName,
10263+ skipIsObjCResolution);
10264+
1022410265 // FIXME: Forces computation of the Objective-C selector.
1022510266 if (!skipIsObjCResolution)
1022610267 (void )isObjC ();
@@ -11652,7 +11693,12 @@ bool ClassDecl::isNonDefaultExplicitDistributedActor(ModuleDecl *M,
1165211693bool ClassDecl::isNativeNSObjectSubclass () const {
1165311694 // @objc actors implicitly inherit from NSObject.
1165411695 if (isActor ()) {
11655- if (getAttrs ().hasAttribute <ObjCAttr>()) {
11696+ DeclAttributes attrs = getAttrs ();
11697+ auto abiRole = ABIRoleInfo (this );
11698+ if (!abiRole.providesAPI () && abiRole.getCounterpart ())
11699+ attrs = abiRole.getCounterpart ()->getAttrs ();
11700+
11701+ if (attrs.hasAttribute <ObjCAttr>()) {
1165611702 return true ;
1165711703 }
1165811704 ClassDecl *superclass = getSuperclassDecl ();
0 commit comments