mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-06 13:32:49 +00:00
Objective-C: Tweak unavailability warning.
Don't warn when a selector has an unavailable and an available variant, and the first also has an implementation. llvm-svn: 224881
This commit is contained in:
parent
dd84ec5fd9
commit
e3b11043d0
@ -2249,7 +2249,7 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List,
|
||||
// Propagate the 'defined' bit.
|
||||
if (Method->isDefined())
|
||||
PrevObjCMethod->setDefined(true);
|
||||
else if (!PrevObjCMethod->isDefined()) {
|
||||
else {
|
||||
// Objective-C doesn't allow an @interface for a class after its
|
||||
// @implementation. So if Method is not defined and there already is
|
||||
// an entry for this type signature, Method has to be for a different
|
||||
|
@ -263,11 +263,24 @@ const char * func() {
|
||||
@end
|
||||
|
||||
@interface InterfaceWithSameMethodAsUndeclaredImpl
|
||||
- (void)partiallyUnavailableMethod __attribute__((unavailable)); // expected-note{{explicitly marked unavailable here}}
|
||||
- (void)partiallyUnavailableMethod __attribute__((unavailable));
|
||||
@end
|
||||
|
||||
void f(id a) {
|
||||
// FIXME: Warning on this looks incorrect, since `a` could be an
|
||||
// UndeclaredImpl object, where this method isn't inavailable.
|
||||
[a partiallyUnavailableMethod]; // expected-error{{is unavailable}}
|
||||
[a partiallyUnavailableMethod]; // no warning, `a` could be an UndeclaredImpl.
|
||||
}
|
||||
|
||||
@interface InterfaceWithImplementation
|
||||
- (void)anotherPartiallyUnavailableMethod;
|
||||
@end
|
||||
@implementation InterfaceWithImplementation
|
||||
- (void)anotherPartiallyUnavailableMethod {}
|
||||
@end
|
||||
|
||||
@interface InterfaceWithSameMethodAsInterfaceWithImplementation
|
||||
- (void)anotherPartiallyUnavailableMethod __attribute__((unavailable));
|
||||
@end
|
||||
|
||||
void g(id a) {
|
||||
[a anotherPartiallyUnavailableMethod]; // no warning, `a` could be an InterfaceWithImplementation.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user