
We have a new policy in place making links to private resources something we try to avoid in source and test files. Normally, we'd organically switch to the new policy rather than make a sweeping change across a project. However, Clang is in a somewhat special circumstance currently: recently, I've had several new contributors run into rdar links around test code which their patch was changing the behavior of. This turns out to be a surprisingly bad experience, especially for newer folks, for a handful of reasons: not understanding what the link is and feeling intimidated by it, wondering whether their changes are actually breaking something important to a downstream in some way, having to hunt down strangers not involved with the patch to impose on them for help, accidental pressure from asking for potentially private IP to be made public, etc. Because folks run into these links entirely by chance (through fixing bugs or working on new features), there's not really a set of problematic links to focus on -- all of the links have basically the same potential for causing these problems. As a result, this is an omnibus patch to remove all such links. This was not a mechanical change; it was done by manually searching for rdar, radar, radr, and other variants to find all the various problematic links. From there, I tried to retain or reword the surrounding comments so that we would lose as little context as possible. However, because most links were just a plain link with no supporting context, the majority of the changes are simple removals. Differential Review: https://reviews.llvm.org/D158071
128 lines
3.7 KiB
Objective-C
128 lines
3.7 KiB
Objective-C
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
|
|
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
|
|
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
|
|
// RUN: %clang_cc1 -x objective-c++ -fobjc-arc -fsyntax-only -verify -Wno-objc-root-class %s
|
|
|
|
#if __has_attribute(objc_requires_super)
|
|
#define NS_REQUIRES_SUPER __attribute((objc_requires_super))
|
|
#endif
|
|
|
|
@protocol NSObject // expected-note {{protocol is declared here}}
|
|
- MyDealloc NS_REQUIRES_SUPER; // expected-warning {{'objc_requires_super' attribute cannot be applied to methods in protocols}}
|
|
@end
|
|
|
|
@interface Root
|
|
- MyDealloc __attribute((objc_requires_super));
|
|
- (void)XXX __attribute((objc_requires_super));
|
|
- (void) dealloc __attribute((objc_requires_super)); // expected-warning {{'objc_requires_super' attribute cannot be applied to dealloc}}
|
|
- (void) MyDeallocMeth; // Method in root is not annotated.
|
|
- (void) AnnotMyDeallocMeth __attribute((objc_requires_super));
|
|
- (void) AnnotMyDeallocMethCAT NS_REQUIRES_SUPER;
|
|
|
|
+ (void)registerClass:(id)name __attribute((objc_requires_super));
|
|
@end
|
|
|
|
@interface Baz : Root<NSObject>
|
|
- MyDealloc;
|
|
- (void) MyDeallocMeth __attribute((objc_requires_super)); // 'Baz' author has annotated method
|
|
- (void) AnnotMyDeallocMeth; // Annotated in root but not here. Annotation is inherited though
|
|
- (void) AnnotMeth __attribute((objc_requires_super)); // 'Baz' author has annotated method
|
|
@end
|
|
|
|
@implementation Baz
|
|
- MyDealloc {
|
|
[super MyDealloc];
|
|
return 0;
|
|
}
|
|
|
|
- (void)XXX {
|
|
[super MyDealloc];
|
|
} // expected-warning {{method possibly missing a [super XXX] call}}
|
|
|
|
- (void) MyDeallocMeth {}
|
|
- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
|
|
- (void) AnnotMeth{};
|
|
|
|
+ (void)registerClass:(id)name {} // expected-warning {{method possibly missing a [super registerClass:] call}}
|
|
@end
|
|
|
|
@interface Bar : Baz
|
|
@end
|
|
|
|
@implementation Bar
|
|
- (void) MyDeallocMeth {} // expected-warning {{method possibly missing a [super MyDeallocMeth] call}}
|
|
- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
|
|
- (void) AnnotMeth{}; // expected-warning {{method possibly missing a [super AnnotMeth] call}}
|
|
@end
|
|
|
|
@interface Bar(CAT)
|
|
- (void) AnnotMyDeallocMethCAT; // Annotated in root but not here. Annotation is inherited though
|
|
- (void) AnnotMethCAT __attribute((objc_requires_super));
|
|
@end
|
|
|
|
@implementation Bar(CAT)
|
|
- (void) MyDeallocMeth {} // expected-warning {{method possibly missing a [super MyDeallocMeth] call}}
|
|
- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
|
|
- (void) AnnotMeth{}; // expected-warning {{method possibly missing a [super AnnotMeth] call}}
|
|
- (void) AnnotMyDeallocMethCAT{}; // expected-warning {{method possibly missing a [super AnnotMyDeallocMethCAT] call}}
|
|
- (void) AnnotMethCAT {};
|
|
@end
|
|
|
|
|
|
@interface Valid : Baz
|
|
@end
|
|
|
|
@implementation Valid
|
|
|
|
- (void)MyDeallocMeth {
|
|
[super MyDeallocMeth]; // no-warning
|
|
}
|
|
|
|
|
|
+ (void)registerClass:(id)name {
|
|
[super registerClass:name]; // no-warning
|
|
}
|
|
|
|
@end
|
|
|
|
@interface UIViewController @end
|
|
|
|
@interface ViewController : UIViewController
|
|
- (void) someMethodRequiringSuper NS_REQUIRES_SUPER;
|
|
- (IBAction) someAction;
|
|
- (IBAction) someActionRequiringSuper NS_REQUIRES_SUPER;
|
|
@end
|
|
|
|
|
|
@implementation ViewController
|
|
- (void) someMethodRequiringSuper
|
|
{
|
|
}
|
|
- (IBAction) someAction
|
|
{
|
|
}
|
|
- (IBAction) someActionRequiringSuper
|
|
{
|
|
}
|
|
@end
|
|
|
|
@interface Barn
|
|
- (void)openDoor __attribute__((objc_requires_super));
|
|
@end
|
|
|
|
@implementation Barn
|
|
- (void) openDoor
|
|
{
|
|
;
|
|
}
|
|
@end
|
|
|
|
@interface HorseBarn:Barn @end
|
|
|
|
@implementation HorseBarn
|
|
- (void) openDoor
|
|
{
|
|
;
|
|
} // expected-warning {{method possibly missing a [super openDoor] call}}
|
|
@end
|