[cfe-commits] patch: recursively define vtables along with template instantiation

Nick Lewycky nlewycky at google.com
Fri Nov 19 17:44:31 PST 2010


This patch changes InstantiateFunctionDefinition to also define used vtables
as it goes recursively instantiating templates. This should allow us to
track where delayed vtable instantiations were requested, fixing PR8640.

Also, this removes the while(1) loop in ActOnEndOfTranslationUnit(). It's
replaced with "PerformPendingInstantiations(); if (DefineUsedVTables())
{ PerformPendingInstantiations(); }" and it's a mystery to me why we need
the first instantiation call. Removing it causes a single test failure in
test/SemaCXX/destructor.cpp (namespace test6):

  // ... class A is defined with a virtual destructor ...
  class B : A<int> { B(); };
  B::B() {} // expected-note {{in instantiation of member function
'test6::A<int>::~A' requested here}}

the note moves onto the previous line. If the existing behaviour is correct
(deriving A<int> instantiates the class but not any of the methods, then
B::B() requires ~A to destruct the object in case of exceptions) then
there's probably another bug in clang where we're adding that the vtable is
needed on the line declaring class B. Alternately, the test is wrong. :)

Please review!

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20101119/fec62b51/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr8640-1.patch
Type: text/x-patch
Size: 5421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20101119/fec62b51/attachment.bin>


More information about the cfe-commits mailing list