File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -958,10 +958,18 @@ ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() {
958
958
auto *CtxD = cast<Decl>(getDeclContext ());
959
959
960
960
if (auto *ImplD = dyn_cast<ObjCImplementationDecl>(CtxD)) {
961
- if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface ())
961
+ if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface ()) {
962
962
if (ObjCMethodDecl *MD = IFD->getMethod (getSelector (),
963
963
isInstanceMethod ()))
964
964
return MD;
965
+ // readwrite properties may have been re-declared in an extension.
966
+ // look harder.
967
+ if (isPropertyAccessor ())
968
+ for (auto *Ext : IFD->known_extensions ())
969
+ if (ObjCMethodDecl *MD =
970
+ Ext->getMethod (getSelector (), isInstanceMethod ()))
971
+ return MD;
972
+ }
965
973
} else if (auto *CImplD = dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
966
974
if (ObjCCategoryDecl *CatD = CImplD->getCategoryDecl ())
967
975
if (ObjCMethodDecl *MD = CatD->getMethod (getSelector (),
Original file line number Diff line number Diff line change @@ -191,6 +191,14 @@ int useRoot(Root *r) {
191
191
return [r getInt ] + [r intProperty ] + [r intProperty2 ];
192
192
}
193
193
194
+ int useFoo (Foo *f) {
195
+ // CHECK-LABEL: define i32 @useFoo
196
+ // CHECK: call void bitcast {{.*}} @"\01-[Foo setGetDynamic_setDirect:]"
197
+ // CHECK: %{{[^ ]*}} = call i32 bitcast {{.*}} @"\01-[Foo getDirect_setDynamic]"
198
+ [f setGetDynamic_setDirect: 1 ];
199
+ return [f getDirect_setDynamic ];
200
+ }
201
+
194
202
__attribute__ ((objc_root_class))
195
203
@interface RootDeclOnly
196
204
@property(direct, readonly) int intProperty;
You can’t perform that action at this time.
0 commit comments