[PATCH] D54986: Make CodeGen choose when to emit vtables.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 27 19:51:51 PST 2018


rsmith created this revision.
rsmith added reviewers: rjmccall, v.g.vassilev, bruno.
Herald added subscribers: cfe-commits, javed.absar.

Previously, we expected Sema to make this ABI decision for us, resulting
in our emitting vtables in some cases where we didn't need them. With
this change, we emit vtables in precisely three cases:

1. When we emit a reference to the vtable and it has suitable linkage.
2. When we emit a key function definition.
3. When we emit an explicit instantiation of a class.

This also removes the need to mark key functions as "must be emitted",
which means that an inline key function is no longer added to the list
of eagerly deserialized declarations in an AST file.

In exchange, we do now list explicit instantiation definitions of
dynamic classes as eagerly deserialized declarations. But they should
be much rarer in header files!


Repository:
  rC Clang

https://reviews.llvm.org/D54986

Files:
  lib/AST/ASTContext.cpp
  lib/AST/RecordLayoutBuilder.cpp
  lib/CodeGen/CGCXX.cpp
  lib/CodeGen/CGCXXABI.h
  lib/CodeGen/CGVTables.cpp
  lib/CodeGen/CodeGenAction.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  lib/CodeGen/ModuleBuilder.cpp
  lib/Serialization/ASTReaderDecl.cpp
  test/CodeGenCXX/aarch64-cxxabi.cpp
  test/CodeGenCXX/key-function-vtable.cpp
  test/CodeGenCXX/rtti-linkage.cpp
  test/CodeGenCXX/type_visibility.cpp
  test/CodeGenCXX/visibility.cpp
  test/CodeGenCXX/vtt-layout.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54986.175617.patch
Type: text/x-patch
Size: 47838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181128/721e6d1a/attachment-0001.bin>


More information about the cfe-commits mailing list