[cfe-commits] r92753 - in /cfe/trunk: lib/AST/DeclCXX.cpp lib/AST/RecordLayoutBuilder.cpp lib/CodeGen/CGVtable.cpp lib/CodeGen/CodeGenModule.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp test/CodeGenCXX/vtable-key-function.cpp test/CodeGenCXX/vtable-linkage.cpp

Chris Lattner clattner at apple.com
Tue Jan 5 11:46:22 PST 2010


On Jan 5, 2010, at 11:06 AM, Douglas Gregor wrote:

> Author: dgregor
> Date: Tue Jan  5 13:06:31 2010
> New Revision: 92753
>
> URL: http://llvm.org/viewvc/llvm-project?rev=92753&view=rev
> Log:
> Improve key-function computation for templates. In particular:
>  - All classes can have a key function; templates don't change that.
>  non-template classes when computing the key function.
>  - We always mark all of the virtual member functions of class
>  template instantiations.
>  - The vtable for an instantiation of a class template has weak
>  linkage.
>
> We could probably use available_externally linkage for vtables of
> classes instantiated by explicit instantiation declarations (extern
> templates), but GCC doesn't do this and I'm not 100% that the ABI
> permits it.

GCC is missing several optimizations in this area that prevent  
devirtualization etc.  available_externally can be used any time we  
know the contents of the object and we know it will be emitted to some  
other translation unit.  It just gives the optimizer the ability to  
see into the data without emitting it.

-Chris



More information about the cfe-commits mailing list