diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-22 19:46:35 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-22 19:46:35 +0000 |
commit | 0f0b302ffe8e64e93ad3b428523a244a1bcc044f (patch) | |
tree | 7b38965f35168a93ec0afb1d0930b00e1bb59d3b /clang/test | |
parent | d161a8570021d6c3e0ea68fd18ea0526eea73107 (diff) | |
download | bcm5719-llvm-0f0b302ffe8e64e93ad3b428523a244a1bcc044f.tar.gz bcm5719-llvm-0f0b302ffe8e64e93ad3b428523a244a1bcc044f.zip |
Complain on missing property getter method only
if property-dot expression is decidedly
an rvalue. // rdar://8155806.
llvm-svn: 122430
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaObjC/error-missing-getter.m | 19 | ||||
-rw-r--r-- | clang/test/SemaObjC/property-user-setter.m | 10 |
2 files changed, 24 insertions, 5 deletions
diff --git a/clang/test/SemaObjC/error-missing-getter.m b/clang/test/SemaObjC/error-missing-getter.m new file mode 100644 index 00000000000..3c91ab2ffcd --- /dev/null +++ b/clang/test/SemaObjC/error-missing-getter.m @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://8155806 + +@interface Subclass +{ + int setterOnly; +} +- (void) setSetterOnly : (int) arg; +@end + +int func (int arg, Subclass *x) { + if (x.setterOnly) { // expected-error {{expected getter method not found on object of type 'Subclass *'}} + x.setterOnly = 1; + } + func(x.setterOnly + 1, x); // expected-error {{expected getter method not found on object of type 'Subclass *'}} + int i = x.setterOnly + 1; // expected-error {{expected getter method not found on object of type 'Subclass *'}} + return x.setterOnly + 1; // expected-error {{expected getter method not found on object of type 'Subclass *'}} +} + diff --git a/clang/test/SemaObjC/property-user-setter.m b/clang/test/SemaObjC/property-user-setter.m index 9479bc6a73b..2f1e19727a8 100644 --- a/clang/test/SemaObjC/property-user-setter.m +++ b/clang/test/SemaObjC/property-user-setter.m @@ -70,7 +70,7 @@ static int g_val; { int setterOnly; } -- (void) setSetterOnly:(int)value; // expected-note {{or because setter is declared here, but no getter method 'setterOnly' is found}} +- (void) setSetterOnly:(int)value; @end @implementation Subclass @@ -82,14 +82,14 @@ static int g_val; @interface C {} // - (int)Foo; -- (void)setFoo:(int)value; // expected-note 2 {{or because setter is declared here, but no getter method 'Foo' is found}} +- (void)setFoo:(int)value; @end void g(int); void f(C *c) { - c.Foo = 17; // expected-error {{property 'Foo' not found on object of type 'C *'}} - g(c.Foo); // expected-error {{property 'Foo' not found on object of type 'C *'}} + c.Foo = 17; // OK + g(c.Foo); // expected-error {{expected getter method not found on object of type 'C *'}} } @@ -97,7 +97,7 @@ void abort(void); int main (void) { Subclass *x = [[Subclass alloc] init]; - x.setterOnly = 4; // expected-error {{property 'setterOnly' not found on object of type 'Subclass *'}} + x.setterOnly = 4; // OK if (g_val != 4) abort (); return 0; |