[llvm] r254592 - Fix class SCEVPredicate has virtual functions and accessible non-virtual destructor.

Andy Gibbs via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 09:00:02 PST 2015


On Thursday, December 03, 2015 5:29 PM, David Blaikie wrote:
On Thu, Dec 3, 2015 at 12:20 AM, Andy Gibbs wrote:
>> Author: andyg
>> Date: Thu Dec  3 02:20:20 2015
>> New Revision: 254592
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=254592&view=rev
>> Log:
>> Fix class SCEVPredicate has virtual functions and accessible non-virtual 
>> destructor.
>>
>
> Wait - why did the dtor need to be made virtual at all? These objects are 
> never
> destroyed polymorphically, so far as I can tell.
>
> Could we just disable the GCC warning that was firing here instead? (if I
> understand correctly and this was a GCC warning)

Fine, but IMHO the warning is a valid one.  The code may not currently 
destroy these
objects polymorphically, but if that changes in future (for whatever reason) 
then
its a potential memory leak.  Its one of those "golden rule" moments, isn't 
it? :o)

Rather than disable the warning, which could open up potential problems 
elsewhere
not even related to this class, I think it is better to fix the issue, even 
if it is
technically/arguably a non-issue in this case.

Its not like there is a huge overhead (code size, execution time, ...) to 
the fix.
The classes already have vtables due to the other virtual methods, for 
example.

Cheers
Andy



More information about the llvm-commits mailing list