[cfe-dev] Handling inherited virtuals

Chris Lattner clattner at apple.com
Sun Feb 8 11:11:13 PST 2009


On Feb 8, 2009, at 10:28 AM, Douglas Gregor wrote:

>>
>> Naive searching is pretty much a no-starter. We have to make a
>> depth-first search through the entire inheritance hierarchy,
>> collecting
>> pure functions, and then check every class on the path back to see
>> if it
>> overrides these functions, so we can kick them out again, which
>> means a
>> lot of work checking if a function overrides another, which we  
>> already
>> did above.
>> Therefore we should probably keep a list of abstract functions for
>> each
>> class.
>
> This seems entirely reasonable to me. I'm also hoping it can be the
> same data structure we use for conversion functions :)

In the "common" non-multiple inheritance case, you could just keep a  
count of the number of abstract functions you have in a class.  If a  
class is singly derived from it, each abstract method it defines just  
decrements the count, and any new abstract functions it adds  
increments the count.

This doesn't help you in the MI case, but hey it might help :)

-Chris 



More information about the cfe-dev mailing list