[cfe-commits] r79040 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaObjC/attr-malloc.m
Eli Friedman
eli.friedman at gmail.com
Fri Aug 14 14:48:43 PDT 2009
On Fri, Aug 14, 2009 at 1:49 PM, Ted Kremenek<kremenek at apple.com> 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
More information about the cfe-commits
mailing list