On Fri, Aug 14, 2009 at 1:49 PM, Ted Kremenek<[email protected]> wrote:
> @@ -431,17 +438,18 @@
>     return;
>   }
>
> -  if (!isFunctionOrMethod(d)) {
> +  if (!isFunction(d)) {
>     S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
>       << Attr.getName() << 0 /*function*/;
>     return;
>   }
>
> -  if (FunctionDecl *FD = dyn_cast<FunctionDecl>(d)) {
> -    if (!FD->getResultType()->isPointerType()) {
> -      S.Diag(Attr.getLoc(), diag::warn_attribute_malloc_pointer_only);
> -      return;
> -    }
> +  const FunctionDecl *FD = cast<FunctionDecl>(d);
> +  QualType RetTy = FD->getResultType();
> +
> +  if (!(RetTy->isAnyPointerType() || RetTy->isBlockPointerType())) {
> +    S.Diag(Attr.getLoc(), diag::warn_attribute_malloc_pointer_only);
> +    return;
>   }

I believe we went through this before... isFunction doesn't guarantee
that d is a FunctionDecl.

-Eli

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to