[cfe-dev] Marking v-tables used whenever any virtual function is referenced

Richard Smith richard at metafoo.co.uk
Fri Jul 13 20:52:50 PDT 2012


On Fri, Jul 13, 2012 at 7:02 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> The testcase you added to virt-template-vtable.cpp is already passing
> without your patch, anything wrong?


Thanks for catching that, I meant to revert that file. That test is an
(incorrect) precursor to the bug reduction which ended up in
virtual-member-functions.cpp.


> Same goes for the test in
> virtual-member-functions.cpp
>

That one fails for me without the patch:

error: 'error' diagnostics seen but not expected:
  Line 90: implicit instantiation of undefined member
'LazilyInstantiate::A<int>::Impl'
error: 'note' diagnostics seen but not expected:
  Line 96: in instantiation of member function
'LazilyInstantiate::scoped_ptr<LazilyInstantiate::A<int>::Impl>::~scoped_ptr'
requested here
  Line 107: in instantiation of member function
'LazilyInstantiate::A<int>::~A' requested here
  Line 94: member is declared here
4 errors generated.

We instantiate A<int>::F because it's used in C's vtable, which is used in
C's constructor, and that leads to us instantiate A<int>'s vtable, which
leads to us instantiate A<int>'s destructor, which fails. This test started
failing as a result of r159895; prior to that, we weren't instantiating
A<int>::F when building C's vtable. Is it possible you don't have that
revision?


> On 11 July 2012 03:53, Richard Smith <richard at metafoo.co.uk> wrote:
> > Hi,
> >
> > Currently, Clang marks a class's vtable as used (and thus marks as used
> and,
> > potentially, instantiates everything within it) whenever any virtual
> > function in the class is referenced. This seems excessive; is there a
> reason
> > why we'd always want the vtable in such circumstances? (Attached is a
> patch
> > to remove this behavior, which works fine in my -- fairly limited, so
> far --
> > testing).
> >
> > Thanks,
> > Richard
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120713/ce0804a8/attachment.html>


More information about the cfe-dev mailing list