Skip to content

Commit 2660cfc

Browse files
committed
Tidy up inference of '@objc' and 'dynamic' for accessors.
No functionality change.
1 parent 446a824 commit 2660cfc

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4777,21 +4777,18 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
47774777
// The only additional condition we need to check is if the var decl
47784778
// had an @objc or @iboutlet property.
47794779

4780-
ValueDecl *prop = cast<ValueDecl>(FD->getAccessorStorageDecl());
4780+
AbstractStorageDecl *storage = FD->getAccessorStorageDecl();
47814781
// Validate the subscript or property because it might not be type
47824782
// checked yet.
4783-
if (isa<SubscriptDecl>(prop))
4784-
TC.validateDecl(prop);
4785-
else if (isa<VarDecl>(prop))
4786-
TC.validateDecl(prop);
4783+
TC.validateDecl(storage);
47874784

4788-
if (prop->getAttrs().hasAttribute<NonObjCAttr>())
4785+
if (storage->getAttrs().hasAttribute<NonObjCAttr>())
47894786
isObjC = None;
4790-
else if (!isObjC && prop->isObjC())
4787+
else if (!isObjC && storage->isObjC())
47914788
isObjC = ObjCReason::DoNotDiagnose;
47924789

4793-
// If the property is dynamic, propagate to this accessor.
4794-
if (isObjC && prop->isDynamic() && !FD->isDynamic())
4790+
// If the storage is dynamic, propagate to this accessor.
4791+
if (isObjC && storage->isDynamic() && !FD->isDynamic())
47954792
FD->getAttrs().add(new (TC.Context) DynamicAttr(/*implicit*/ true));
47964793
}
47974794

0 commit comments

Comments
 (0)