[llvm-commits] [llvm] r164471 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/Support/ lib/VMCore/

Craig Topper craig.topper at gmail.com
Sun Sep 23 12:09:56 PDT 2012


Originally I was going around looking for methods that were virtual by
virtue of overriding a method, but weren't explicitly listed as virtual.
Which makes it difficult to tell what's virtual just from looking at the
derived class definiton. A couple people pointed out it would be better to
use the C++11 override keyword which gives the added bonus that you find
out when the base class changes.

With the override attribute, my hope is that we can also spot any virtual
methods that don't override anything and don't get overridden. I've already
stumbled onto at least one case of this in the ARM fast isel implementation
that I fixed in r162178. Unfortunately, I'm not sure how to automate
finding those kind of cases.

As part of the implementing of this particular patch I also found that we
have some places where the virtual anchor is called "Anchor()" instead of
"anchor()". In one case this caused a subclass to get both in its vtable
because the super class had anchor() and the subclass had Anchor()

Unfortunately, even if I go through the tree and mark everything with
LLVM_OVERRIDE I have no way to enforce it on new code. I'm currently
detecting it with a plugin I modified based a similar plugin from the
Chromium guys.

~Craig

On Sun, Sep 23, 2012 at 1:12 AM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Craig,
>
> On 23/09/12 04:12, Craig Topper wrote:
>
>> Author: ctopper
>> Date: Sat Sep 22 21:12:10 2012
>> New Revision: 164471
>>
>> URL: http://llvm.org/viewvc/llvm-**project?rev=164471&view=rev<http://llvm.org/viewvc/llvm-project?rev=164471&view=rev>
>> Log:
>> Add LLVM_OVERRIDE to methods that override their base classes.
>>
>
> can you please explain what this is about?
>
> Thanks, Duncan.
> ______________________________**_________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/llvm-commits<http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120923/30af1c7e/attachment.html>


More information about the llvm-commits mailing list