llvm-project/clang/test/SemaObjC/method-lookup-3.m
Aaron Ballman 0f1c1be196 [clang] Remove rdar links; NFC
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
2023-08-28 12:13:42 -04:00

99 lines
2.1 KiB
Objective-C

// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct { int y; } Abstract;
typedef struct { int x; } Alternate;
#define INTERFERE_TYPE Alternate*
@protocol A
@property Abstract *x; // expected-note {{using}}
@end
@interface B
@property Abstract *y; // expected-note {{using}}
@end
@interface B (Category)
@property Abstract *z; // expected-note {{using}}
@end
@interface InterferencePre
-(void) x; // expected-note {{also found}}
-(void) y; // expected-note {{also found}}
-(void) z; // expected-note {{also found}}
-(void) setX: (INTERFERE_TYPE) arg;
-(void) setY: (INTERFERE_TYPE) arg;
-(void) setZ: (INTERFERE_TYPE) arg;
@end
void f0(id a0) {
Abstract *l = [a0 x]; // expected-warning {{multiple methods named 'x' found}}
}
void f1(id a0) {
Abstract *l = [a0 y]; // expected-warning {{multiple methods named 'y' found}}
}
void f2(id a0) {
Abstract *l = [a0 z]; // expected-warning {{multiple methods named 'z' found}}
}
void f3(id a0, Abstract *a1) {
[ a0 setX: a1];
}
void f4(id a0, Abstract *a1) {
[ a0 setY: a1];
}
void f5(id a0, Abstract *a1) {
[ a0 setZ: a1];
}
// pr7861
void f6(id<A> a0) {
Abstract *l = [a0 x];
}
struct test3a { int x, y; };
struct test3b { unsigned x, y; };
@interface Test3A - (struct test3a) test3; @end
@interface Test3B - (struct test3b) test3; @end
void test3(id x) {
(void) [x test3];
}
struct test4a { int x, y; };
struct test4b { float x, y; };
@interface Test4A - (struct test4a) test4; @end //expected-note{{using}}
@interface Test4B - (struct test4b) test4; @end //expected-note{{also found}}
void test4(id x) {
(void) [x test4]; //expected-warning {{multiple methods named 'test4' found}}
}
#pragma clang diagnostic ignored "-Wobjc-multiple-method-names"
@interface NSObject
+ (id)alloc;
+ (id)class;
- (id) init;
@end
@class NSString;
@interface A : NSObject
- (instancetype)initWithType:(NSString *)whatever;
@end
@interface Test : NSObject @end
@implementation Test
+ (instancetype)foo
{
return [[[self class] alloc] initWithType:3];
}
- (instancetype)initWithType:(int)whatever
{
return [super init];
}
@end