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.<br>
<br>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.<br>
<br>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()<br>
<br>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.<br>
<br>~Craig<br><br><div class="gmail_quote">On Sun, Sep 23, 2012 at 1:12 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Craig,<br>
<br>
On 23/09/12 04:12, Craig Topper wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ctopper<br>
Date: Sat Sep 22 21:12:10 2012<br>
New Revision: 164471<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=164471&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=164471&view=rev</a><br>
Log:<br>
Add LLVM_OVERRIDE to methods that override their base classes.<br>
</blockquote>
<br>
can you please explain what this is about?<br>
<br>
Thanks, Duncan.<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
</blockquote></div>