[WPD] Emit vcall_visibility metadata for MicrosoftCXXABI
authorTeresa Johnson <tejohnson@google.com>
Sat, 25 Jan 2020 15:26:09 +0000 (07:26 -0800)
committerTeresa Johnson <tejohnson@google.com>
Mon, 27 Jan 2020 14:22:24 +0000 (06:22 -0800)
commitaf954e441a5170a75687699d91d85e0692929d43
treeed2f4576a8e13aa75e0ebd147d5c2fb4bcc64e9a
parent2a160ba5b0ad065ee7020c787e7f896416be3faa
[WPD] Emit vcall_visibility metadata for MicrosoftCXXABI

Summary:
The MicrosoftCXXABI uses a separate mechanism for emitting vtable
type metadata, and thus didn't pick up the change from D71907
to emit the vcall_visibility metadata under -fwhole-program-vtables.

I believe this is the cause of a Windows bot failure when I committed
follow on change D71913 that required a revert. The failure occurred
in a CFI test that was expecting to not abort because it expected a
devirtualization to occur, and without the necessary vcall_visibility
metadata we would not get devirtualization.

Note in the equivalent code in CodeGenModule::EmitVTableTypeMetadata
(used by the ItaniumCXXABI), we also emit the vcall_visibility metadata
when Virtual Function Elimination is enabled. Since I am not as familiar
with the details of that optimization, I have marked that as a TODO and
am only inserting under -fwhole-program-vtables.

Reviewers: evgeny777

Subscribers: Prazek, ostannard, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73418
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/test/CodeGenCXX/vcall-visibility-metadata.cpp