Open Quuxplusone opened 13 years ago
If the naive check ends up being noisy, we could try only warning if the method in question ends up being called through a base class pointer.
Attached missing_virtual_first_stab.patch
(1678 bytes, text/plain): First stab at warning
Can you paste a few example versions for RefCounted and IPC::Message?
You understood my suggestion correctly. Can you think of other heuristics that could make this work better? Here's another bug this would've caught: http://codereview.chromium.org/7468010/
(In reply to comment #3)
> Can you paste a few example versions for RefCounted and IPC::Message?
>
> You understood my suggestion correctly. Can you think of other heuristics that
> could make this work better? Here's another bug this would've caught:
> http://codereview.chromium.org/7468010/
Some examples using the patch I attached before:
/base/memory/ref_counted.h:87:3: error: 'base::RefCounted::~RefCounted<T>'
would override 'base::subtle::RefCountedBase::~RefCountedBase' if it
were virtual [-Werror]
./base/memory/ref_counted.h:89:8: error: 'base::RefCounted::AddRef' would
override 'base::subtle::RefCountedBase::AddRef' if it were virtual
[-Werror]
./content/common/devtools_messages.h:64:1: error:
'DevToolsClientMsg_DebuggerOutput::Log' would override 'IPC::Message::Log' if
it were virtual
third_party/WebKit/Source/JavaScriptCore/wtf/Vector.h:365:9: warning:
'WTF::VectorBuffer<char, 0>::~VectorBuffer' would override
'WTF::VectorBufferBase<char>::~VectorBufferBase' if it were virtual
Looks like this won't fly, then.
How much better does this get when you filter out destructors?
(see http://crbug.com/115925 for another bug like this :-/)
missing_virtual_first_stab.patch
(1678 bytes, text/plain)