[llvm] r204560 - remove a bunch of unused private methods

Nuno Lopes nunoplopes at sapo.pt
Mon Mar 24 13:02:24 PDT 2014


> On Mon, Mar 24, 2014 at 07:12:49PM -0000, Nuno Lopes wrote:
>>> On Sun, Mar 23, 2014 at 6:34 PM, David Blaikie <dblaikie at gmail.com> 
>>> wrote:
>>>> On Sun, Mar 23, 2014 at 10:09 AM, Nuno Lopes <nunoplopes at sapo.pt> 
>>>> wrote:
>>>>> Author: nlopes
>>>>> Date: Sun Mar 23 12:09:26 2014
>>>>> New Revision: 204560
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=204560&view=rev
>>>>> Log:
>>>>> remove a bunch of unused private methods
>>>>> found with a smarter version of -Wunused-member-function that I'm
>>>>> playwing with.
>>>>
>>>> Just out of curiosity - in what way are you making this warning 
>>>> smarter?
>>>
>>> See his post to cfe :)
>>>
>>> -eric
>>
>> Right, it's here:
>> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140317/101883.html
>>
>> In summary, I want to detect unused private methods. To avoid
>> false-positives, the warning is only triggered if all the methods of the
>> class have a definition in the given TU.
>> The 2nd part of the plan is to mark such private methods as internal,
>> meaning more optimizations :)   (actually I was surprised to find out
>> that we are not doing that ATM).
>
> Would this be a legal transformation? What if the client uses a trick
> such as the one described here to access a private member:
> http://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html

Well, in that case a pointer to the private member is taken, so it should be 
fine.
Anyway, I would prefer if we had that discussion in the cfe ML, so that the 
language laywers can chime in.  I'm not a C++ expert; I was just curious why 
we are not exploiting private members/fields more aggressively.

Thanks for the pointer!
Nuno 




More information about the llvm-commits mailing list