r176832 - Objective-C: When using super.prop, property should be

Jean-Daniel Dupas devlists at shadowlab.org
Tue Mar 12 07:55:05 PDT 2013


Le 11 mars 2013 à 23:26, Fariborz Jahanian <fjahanian at apple.com> a écrit :

> Author: fjahanian
> Date: Mon Mar 11 17:26:33 2013
> New Revision: 176832
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=176832&view=rev
> Log:
> Objective-C: When using super.prop, property should be
> looked up the current class's super class.
> // rdar://13349296
> 
> Modified:
>    cfe/trunk/lib/Sema/SemaExprObjC.cpp
>    cfe/trunk/test/Coverage/objc-language-features.inc
>    cfe/trunk/test/SemaObjC/super-property-notation.m

…

> 
> Modified: cfe/trunk/test/SemaObjC/super-property-notation.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/super-property-notation.m?rev=176832&r1=176831&r2=176832&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaObjC/super-property-notation.m (original)
> +++ cfe/trunk/test/SemaObjC/super-property-notation.m Mon Mar 11 17:26:33 2013
> @@ -1,5 +1,4 @@
> -// RUN: %clang_cc1 -fsyntax-only -verify %s
> -// expected-no-diagnostics
> +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s
> 
> @interface B
> +(int) classGetter;
> @@ -29,3 +28,25 @@ void f0() {
>   int l2 = [A classGetter2];
> }
> 
> +// rdar://13349296
> +__attribute__((objc_root_class)) @interface ClassBase 
> + at property (nonatomic, retain) ClassBase * foo;
> + at end
> +
> + at implementation ClassBase 
> +- (void) Meth:(ClassBase*)foo {
> +  super.foo = foo; // expected-error {{'ClassBase' cannot use 'super' because it is a root class}}
> +  [super setFoo:foo]; // expected-error {{'ClassBase' cannot use 'super' because it is a root class}}
> +}
> + at end
> +
> + at interface ClassDerived : ClassBase 
> + at property (nonatomic, retain) ClassDerived * foo;
> + at end
> +
> + at implementation ClassDerived
> +- (void) Meth:(ClassBase*)foo {
> +  super.foo = foo; // issues compile warning


If it issues a compile warning, why is there no expected-warning {{ }} here ? 


> +  [super setFoo:foo]; // works with no warning
> +}
> + at end

-- Jean-Daniel








More information about the cfe-commits mailing list