llvm-project/clang/test/FixIt/fixit-objc-direct.m
Pierre Habouzit 3adcc78a80 [objc_direct] Small updates to help with adoption.
Add fixits for messaging self in MRR or using super, as the intent is
clear, and it turns out people do that a lot more than expected.

Allow for objc_direct_members on main interfaces, it's extremely useful
for internal only classes, and proves to be quite annoying for adoption.

Add some better warnings around properties direct/non-direct clashes (it
was done for methods but properties were a miss).

Add some errors when direct properties are marked @dynamic.

Radar-Id: rdar://problem/58355212
Signed-off-by: Pierre Habouzit <phabouzit@apple.com>
Differential Revision: https://reviews.llvm.org/D73755
2020-02-16 16:32:41 -08:00

31 lines
945 B
Objective-C

// Objective-C recovery
// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck -check-prefix=CHECK-MRR %s
// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-arc -fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck -check-prefix=CHECK-ARC %s
__attribute__((objc_root_class))
@interface Root
+ (void)classDirectMethod __attribute__((objc_direct));
+ (void)classDirectMethod2 __attribute__((objc_direct));
- (void)instanceDirectMethod __attribute__((objc_direct));
@end
@interface A : Root
@end
@implementation A
+ (void)classMethod {
// CHECK-MRR: {18:4-18:8}:"Root"
[self classDirectMethod];
}
+ (void)classMethod2 {
// CHECK-MRR: {23:4-23:9}:"Root"
// CHECK-ARC: {23:4-23:9}:"self"
[super classDirectMethod2];
}
- (void)instanceMethod {
// CHECK-MRR: {28:4-28:9}:"self"
// CHECK-ARC: {28:4-28:9}:"self"
[super instanceDirectMethod];
}
@end