summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGVTables.h
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-07-01 20:30:31 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-07-01 20:30:31 +0000
commit31dc433dd56e1d5fdcccbf4f070b0bc801e0a91c (patch)
treedeb608f5db8038c3554ee42d10e7e4403d6a290f /lib/CodeGen/CGVTables.h
parent59819d42357084dc2addccf624f3af34be510f0e (diff)
MS ABI: Reference MSVC RTTI from the VFTable
The pointer for a class's RTTI data comes right before the VFTable but has no name. To be properly compatible with this, we do the following: * Create a single GlobalVariable which holds the contents of the VFTable _and_ the pointer to the RTTI data. * Create a GlobalAlias, with appropriate linkage/visibility, that points just after the RTTI data pointer. This ensures that the VFTable symbol will always refer to VFTable data. * Create a Comdat with a "Largest" SelectionKind and stick the private GlobalVariable in it. By transitivity, the GlobalAlias will be a member of the Comdat group. Using "Largest" ensures that foreign definitions without an RTTI data pointer will _not_ be chosen in the final linked image. Whether or not we emit RTTI data depends on several things: * The -fno-rtti flag implies that we should never not emit a pointer to RTTI data before the VFTable. * __declspec(dllimport) brings in the VFTable from a remote DLL. Use an available_externally GlobalVariable to provide a local definition of the VFTable. This means that we won't have any available_externally definitions of things like complete object locators. This is acceptable because they are never directly referenced. To my knowledge, this completes the implementation of MSVC RTTI code generation. Further semantic work should be done to properly support /GR-. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.h')
-rw-r--r--lib/CodeGen/CGVTables.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/CodeGen/CGVTables.h b/lib/CodeGen/CGVTables.h
index ba67ed41d3..69cf079567 100644
--- a/lib/CodeGen/CGVTables.h
+++ b/lib/CodeGen/CGVTables.h
@@ -61,11 +61,10 @@ public:
/// decl.
/// \param Components - The vtable components; this is really an array of
/// VTableComponents.
- llvm::Constant *CreateVTableInitializer(const CXXRecordDecl *RD,
- const VTableComponent *Components,
- unsigned NumComponents,
- const VTableLayout::VTableThunkTy *VTableThunks,
- unsigned NumVTableThunks);
+ llvm::Constant *CreateVTableInitializer(
+ const CXXRecordDecl *RD, const VTableComponent *Components,
+ unsigned NumComponents, const VTableLayout::VTableThunkTy *VTableThunks,
+ unsigned NumVTableThunks, llvm::Constant *RTTI);
CodeGenVTables(CodeGenModule &CGM);