On Tue, Jan 8, 2013 at 11:30 PM, Rafael Espindola
<[email protected]> wrote:
> Author: rafael
> Date: Tue Jan  8 15:30:32 2013
> New Revision: 171899
>
> URL: http://llvm.org/viewvc/llvm-project?rev=171899&view=rev
> Log:
> Don't crash when trying to apply the availability attribute to a block.
>
> Modified:
>     cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>     cfe/trunk/test/Sema/attr-availability.c
>
> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=171899&r1=171898&r2=171899&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Jan  8 15:30:32 2013
> @@ -2131,6 +2131,12 @@
>      S.Diag(PlatformLoc, diag::warn_availability_unknown_platform)
>        << Platform;
>
> +  NamedDecl *ND = dyn_cast<NamedDecl>(D);
> +  if (!ND) {
> +    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
> +    return;
> +  }

Rafael,

I'm concerned by attribute abuse.  We just warn on too many weird
cases instead of throwing an error.  I can understand "legacy code"
reasons, but this particular case never compiled, so there's no reason
to be forgiving.

Maybe I am misunderstanding something...

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to