brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 6877cdd Raw
49 lines · plain
1// RUN: %clang_cc1 -fobjc-arc -fsyntax-only -verify -Wselector-type-mismatch %s2 3extern Class object_getClass(id);4 5__attribute__((objc_root_class))6@interface Root7- (Class)class;8+ (void)directMethod __attribute__((objc_direct)); // expected-note {{direct method 'directMethod' declared here}}9+ (void)anotherDirectMethod __attribute__((objc_direct));10@end11 12@implementation Root13- (Class)class14{15  return object_getClass(self);16}17+ (void)directMethod {18}19+ (void)anotherDirectMethod {20  [self directMethod]; // this should not warn21}22+ (void)regularMethod {23  [self directMethod];        // this should not warn24  [self anotherDirectMethod]; // this should not warn25}26- (void)regularInstanceMethod {27  [[self class] directMethod]; // expected-error {{messaging a Class with a method that is possibly direct}}28}29@end30 31@interface Sub : Root32@end33 34@implementation Sub35+ (void)foo {36  [self directMethod]; // this should not warn37}38@end39 40__attribute__((objc_root_class))41@interface Other42@end43 44@implementation Other45+ (void)bar {46  [self directMethod]; // expected-error {{no known class method for selector 'directMethod'}}47}48@end49