mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 22:46:37 +00:00

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
155 lines
3.2 KiB
Objective-C
155 lines
3.2 KiB
Objective-C
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
|
|
|
|
@interface I0
|
|
@property(readonly) int x;
|
|
@property(readonly) int y;
|
|
@property(readonly) int z;
|
|
-(void) setY: (int) y0;
|
|
@end
|
|
|
|
@interface I0 (Cat0)
|
|
-(void) setX: (int) a0;
|
|
@end
|
|
|
|
@implementation I0
|
|
@dynamic x;
|
|
@dynamic y;
|
|
@dynamic z;
|
|
-(void) setY: (int) y0{}
|
|
|
|
-(void) im0 {
|
|
self.x = 0;
|
|
self.y = 2;
|
|
self.z = 2; // expected-error {{assignment to readonly property}}
|
|
}
|
|
@end
|
|
|
|
// Test when property is 'readonly' but it has a setter in
|
|
// its implementation only.
|
|
@interface I1 {
|
|
}
|
|
@property(readonly) int identifier;
|
|
@end
|
|
|
|
|
|
@implementation I1
|
|
@dynamic identifier;
|
|
- (void)setIdentifier:(int)ident {}
|
|
|
|
- (id)initWithIdentifier:(int)Arg {
|
|
self.identifier = 0;
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
// Also in a category implementation
|
|
@interface I1(CAT)
|
|
@property(readonly) int rprop;
|
|
@end
|
|
|
|
|
|
@implementation I1(CAT)
|
|
@dynamic rprop;
|
|
- (void)setRprop:(int)ident {}
|
|
|
|
- (id)initWithIdentifier:(int)Arg {
|
|
self.rprop = 0;
|
|
}
|
|
|
|
@end
|
|
|
|
static int g_val;
|
|
|
|
@interface Root
|
|
+ alloc;
|
|
- init;
|
|
@end
|
|
|
|
@interface Subclass : Root
|
|
{
|
|
int setterOnly;
|
|
}
|
|
- (void) setSetterOnly:(int)value;
|
|
@end
|
|
|
|
@implementation Subclass
|
|
- (void) setSetterOnly:(int)value {
|
|
setterOnly = value;
|
|
g_val = setterOnly;
|
|
}
|
|
@end
|
|
|
|
@interface C {}
|
|
// - (int)Foo;
|
|
- (void)setFoo:(int)value;
|
|
@end
|
|
|
|
void g(int);
|
|
|
|
void f(C *c) {
|
|
c.Foo = 17; // OK
|
|
g(c.Foo); // expected-error {{no getter method for read from property}}
|
|
}
|
|
|
|
|
|
void abort(void);
|
|
int main (void) {
|
|
Subclass *x = [[Subclass alloc] init];
|
|
|
|
x.setterOnly = 4; // OK
|
|
if (g_val != 4)
|
|
abort ();
|
|
return 0;
|
|
}
|
|
|
|
@interface rdar11363363
|
|
{
|
|
id R;
|
|
}
|
|
@property (copy) id p;
|
|
@property (copy) id r;
|
|
@property (copy) id Q;
|
|
@property (copy) id t; // expected-note 2 {{property declared here}}
|
|
@property (copy) id T; // expected-note 2 {{property declared here}}
|
|
@property (copy) id Pxyz; // expected-note 2 {{property declared here}}
|
|
@property (copy) id pxyz; // expected-note 2 {{property declared here}}
|
|
@end
|
|
|
|
@implementation rdar11363363
|
|
@synthesize p;
|
|
@synthesize r;
|
|
@synthesize Q;
|
|
@synthesize t, T;
|
|
@synthesize Pxyz, pxyz;
|
|
- (id) Meth {
|
|
self.P = 0; // expected-warning {{property 'P' not found on object of type 'rdar11363363 *'; did you mean to access property p?}}
|
|
self.q = 0; // expected-warning {{property 'q' not found on object of type 'rdar11363363 *'; did you mean to access property Q?}}
|
|
self.t = 0; // expected-error {{synthesized properties 't' and 'T' both claim setter 'setT:'}}
|
|
self.T = 0; // expected-error {{synthesized properties 'T' and 't' both claim setter 'setT:'}}
|
|
self.Pxyz = 0; // expected-error {{synthesized properties 'Pxyz' and 'pxyz' both claim setter 'setPxyz:'}}
|
|
self.pxyz = 0; // expected-error {{synthesized properties 'pxyz' and 'Pxyz' both claim setter 'setPxyz:'}}
|
|
self.r = 0;
|
|
return self.R; // expected-error {{no getter method for read from property}} \
|
|
// expected-warning {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access property r?}}
|
|
}
|
|
@end
|
|
|
|
@class BridgeFormatter;
|
|
|
|
@interface FMXBridgeFormatter
|
|
|
|
@property(assign, readwrite, getter=formatter, setter=setFormatter:) BridgeFormatter* cppFormatter;
|
|
|
|
@end
|
|
|
|
@implementation FMXBridgeFormatter
|
|
@synthesize cppFormatter;
|
|
|
|
- (void) dealloc
|
|
{
|
|
self.formatter = 0;
|
|
}
|
|
@end
|
|
|