[PATCH] D56816: [ObjC] Follow-up r350768 and allow the use of unavailable methods that are declared in a parent class from within the @implementation context

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 16 16:24:54 PST 2019


erik.pilkington added inline comments.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:7374-7378
+              (MD->isDefined() ||
+               (MD->getClassInterface() &&
+                MD->getClassInterface()->getSuperClass() &&
+                MD->getClassInterface()->getSuperClass()->lookupMethod(
+                    MD->getSelector(), MD->isInstanceMethod()))))
----------------
Why not just always accept a use of an unavailable method so long as its declared in the interface?

i.e., doesn't it make sense to accept something like the following? It seems like you're going out of your way to reject it though:

```
@interface Base 
-(void)doAThing;
-(void)doAThingImpl __attribute__((unavailable));
@end

@implemenation Base
-(void)doAThing { [self doAThingImpl]; }
@end

@interface Derived1 : Base @end
@interface Derived2 : Base @end

@implementation Derived1 
-(void)doAThingImpl { ... }
@end

@implementation Derived2
-(void)doAThingImpl { ... }
@end
```


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56816/new/

https://reviews.llvm.org/D56816





More information about the cfe-commits mailing list