[cfe-dev] Callee declarations and explicit casts

Abramo Bagnara abramo.bagnara at gmail.com
Wed Sep 14 00:07:13 PDT 2011


Il 14/09/2011 01:27, John McCall ha scritto:
> On Sep 13, 2011, at 4:08 PM, John McCall wrote:
>> Author: rjmccall
>> Date: Tue Sep 13 18:08:34 2011
>> New Revision: 139659
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=139659&view=rev
>> Log:
>> In general, don't look through explicit casts when trying
>> to find the called declaration.  Explicit casts can radically
>> change the semantics of a call, and it's no longer really a
>> builtin call any more than it would be a builtin call if you stored
>> the function pointer into a variable and called that.
> 
> I wanted to raise this issue here, partly to gain greater visibility
> and partly to gauge people's opinions.  This commit arose out of
> an IR generation bug (which I fixed separately in r139657) where
> IR generation was assuming that the semantics of making a call
> to a function were the same whether you evaluated the callee
> normally or whether you evaluated it by directly taking the
> address of the function.  Obviously, this is not true in the presence
> of explicit casts.
> 
> Now, it struck me (and Doug) as pretty suspect for getCalleeDecl()
> to ever look through an explicit cast, precisely because that's a
> potentially very important change in the call behavior.  Ergo, this
> change.  However, this is clearly a balance between clients who
> really don't care about explicit casts (and therefore would prefer
> getCalleeDecl() to look through them) and clients who haven't
> considered whether their analysis is reasonable in the face of
> explicit casts (and therefore would probably prefer
> getCalleeDecl() to not look through them).
> 
> So consider this an opportunity to register your opinion and maybe
> get this changed back.

No-op explicit cast are ignored?



More information about the cfe-dev mailing list