[clang] Frontend components for the relative vtables ABI (round 2)
authorLeonard Chan <leonardchan@google.com>
Thu, 11 Jun 2020 18:17:08 +0000 (11:17 -0700)
committerLeonard Chan <leonardchan@google.com>
Thu, 11 Jun 2020 18:17:08 +0000 (11:17 -0700)
commit71568a9e28d6aa5ed580cbedcb96634452555143
tree372760616c8aae1b2af1c5778c90858f99fd5ebf
parent59491b208f3f267424aa4b1de8b8945047c4329a
[clang] Frontend components for the relative vtables ABI (round 2)

This patch contains all of the clang changes from D72959.

- Generalize the relative vtables ABI such that it can be used by other targets.
- Add an enum VTableComponentLayout which controls whether components in the
  vtable should be pointers to other structs or relative offsets to those structs.
  Other ABIs can change this enum to restructure how components in the vtable
  are laid out/accessed.
- Add methods to ConstantInitBuilder for inserting relative offsets to a
  specified position in the aggregate being constructed.
- Fix failing tests under new PM and ASan and MSan issues.

See D72959 for background info.

Differential Revision: https://reviews.llvm.org/D77592
42 files changed:
clang/include/clang/AST/VTableBuilder.h
clang/include/clang/Basic/LangOptions.def
clang/include/clang/CodeGen/ConstantInitBuilder.h
clang/include/clang/Driver/Options.td
clang/lib/AST/ASTContext.cpp
clang/lib/AST/VTableBuilder.cpp
clang/lib/CodeGen/CGClass.cpp
clang/lib/CodeGen/CGVTables.cpp
clang/lib/CodeGen/CGVTables.h
clang/lib/CodeGen/ConstantInitBuilder.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/available_externally-vtable.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/child-inheritted-from-parent-in-comdat.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/child-vtable-in-comdat.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/cross-translation-unit-1.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/cross-translation-unit-2.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/cross-tu-header.h [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/diamond-virtual-inheritance.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/inheritted-virtual-function.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/inline-virtual-function.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/inlined-key-function.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/member-function-pointer.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/multiple-inheritance.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/no-alias-when-dso-local.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/no-stub-when-dso-local.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/override-pure-virtual-method.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/overriden-virtual-function.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/parent-and-child-in-comdats.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/parent-vtable-in-comdat.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/pass-byval-attributes.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/relative-vtables-flag.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/simple-vtable-definition.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/stub-linkages.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/thunk-mangling.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/type-info.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/vbase-offset.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/virtual-function-call.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/RelativeVTablesABI/vtable-hidden-when-in-comdat.cpp [new file with mode: 0644]