[cfe-commits] r146737 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaObjC/nsobject-attribute.m

Eli Friedman eli.friedman at gmail.com
Fri Dec 16 17:27:21 PST 2011


On Fri, Dec 16, 2011 at 7:54 AM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Fri Dec 16 09:54:29 2011
> New Revision: 146737
>
> URL: http://llvm.org/viewvc/llvm-project?rev=146737&view=rev
> Log:
> objc: after issuing the warning on direct use of __attribute__((NSObject))
> on properties, prevent consequential error  diagnostics. // rdar://10591336
>
> Modified:
>    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>    cfe/trunk/test/SemaObjC/nsobject-attribute.m
>
> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=146737&r1=146736&r2=146737&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Dec 16 09:54:29 2011
> @@ -1753,10 +1753,8 @@
>       return;
>     }
>   }
> -  else {
> +  else
>     S.Diag(D->getLocation(), diag::warn_nsobject_attribute);
> -    return;
> -  }
>   D->addAttr(::new (S.Context) ObjCNSObjectAttr(Attr.getRange(), S.Context));
>  }
>
>
> Modified: cfe/trunk/test/SemaObjC/nsobject-attribute.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/nsobject-attribute.m?rev=146737&r1=146736&r2=146737&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaObjC/nsobject-attribute.m (original)
> +++ cfe/trunk/test/SemaObjC/nsobject-attribute.m Fri Dec 16 09:54:29 2011
> @@ -45,8 +45,7 @@
>  {
>    __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}}
>  }
> - at property (nonatomic, retain) __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} \
> -                                // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
> + at property (nonatomic, retain) __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}}
>  @end
>  void test_10453342() {
>     char* __attribute__((NSObject)) string2 = 0; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}}

If it suppresses an error, we clearly aren't ignoring the attribute...
printing this warning in this case makes no sense.

-Eli




More information about the cfe-commits mailing list