[cfe-commits] r79041 - /cfe/trunk/lib/Sema/SemaDeclAttr.cpp
Ted Kremenek
kremenek at apple.com
Fri Aug 14 14:58:22 PDT 2009
On Aug 14, 2009, at 2:53 PM, Ted Kremenek wrote:
>
> On Aug 14, 2009, at 2:51 PM, Eli Friedman wrote:
>
>> On Fri, Aug 14, 2009 at 1:51 PM, Ted Kremenek<kremenek at apple.com>
>> wrote:
>>> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Aug 14 15:51:58 2009
>>> @@ -438,13 +438,14 @@
>>> return;
>>> }
>>>
>>> - if (!isFunction(d)) {
>>> + const FunctionDecl *FD = dyn_cast<FunctionDecl>(d);
>>> +
>>> + if (!FD) {
>>> S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
>>> << Attr.getName() << 0 /*function*/;
>>> return;
>>> }
>>
>> Unless I'm mistaken, this breaks constructs like the following:
>> __attribute((malloc)) void *(*f)();
>>
>> -Eli
>
> Thanks for pointing this out. I'll fix it.
Incidentally, the previous code didn't explicitly handle that case
either. The return type of the function pointer wouldn't actually be
checked to see if it was a pointer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090814/54e5f42c/attachment.html>
More information about the cfe-commits
mailing list