[cfe-commits] [patch] Correctly handle a explicit template instantiation definition after a declaration

Rafael Espindola espindola at google.com
Thu Mar 11 19:41:28 PST 2010


I am not sure if this patch actually changes any output produced by
clang, but it might be desirable as a cleanup.

Background: When I first implemented the needsVtable function in
SemaDeclCXX.cpp Douglas asked that it should return false for
TSK_ExplicitInstantiationDeclaration. Unfortunately that introduced a
regression. Finally I was able to debug what was going on. The problem
is that in code like

------------------------------------
class Option {
  virtual ~Option();
};
template <class DataType> class opt : public Option {
  virtual bool handleOccurrence() {
  }
};
extern template class opt<unsigned>;
template class opt<unsigned>;
-------------------------------------

We would call MaybeMarkVirtualMembersReferenced with a method attached
to the extern template and then decide that we would not need the
vtable.

Is the patch OK or the real solution is somewhere else?

Cheers,
-- 
Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: template.patch
Type: text/x-diff
Size: 1231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100311/9c007b4b/attachment.patch>


More information about the cfe-commits mailing list