[MS-ABI] Implements MS-compatible RTTI
Enables the emission of MS-compatible RTTI data structures for use with
typeid, dynamic_cast and exceptions. Does not implement dynamic_cast
or exceptions. As an artiface, typeid works in some cases but proper
support an testing will coming in a subsequent patch.
majnemer has fuzzed the results. Test cases included.
Differential Revision: http://reviews.llvm.org/D3833
llvm-svn: 209523
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 7b46729..eff51ce 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -528,10 +528,10 @@
AtomicGetterHelperFnMap[Ty] = Fn;
}
- llvm::Constant *getTypeDescriptor(QualType Ty) {
+ llvm::Constant *getTypeDescriptorFromMap(QualType Ty) {
return TypeDescriptorMap[Ty];
}
- void setTypeDescriptor(QualType Ty, llvm::Constant *C) {
+ void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C) {
TypeDescriptorMap[Ty] = C;
}
@@ -710,6 +710,12 @@
/// The type of a generic block literal.
llvm::Type *getGenericBlockLiteralType();
+ /// \brief Gets or a creats a Microsoft TypeDescriptor.
+ llvm::Constant *getMSTypeDescriptor(QualType Ty);
+ /// \brief Gets or a creats a Microsoft CompleteObjectLocator.
+ llvm::GlobalVariable *getMSCompleteObjectLocator(const CXXRecordDecl *RD,
+ const VPtrInfo *Info);
+
/// Gets the address of a block which requires no captures.
llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, const char *);
@@ -945,6 +951,9 @@
F->setLinkage(getFunctionLinkage(GD));
}
+ /// \brief Returns the appropriate linkage for the TypeInfo struct for a type.
+ llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(QualType Ty);
+
/// Return the appropriate linkage for the vtable, VTT, and type information
/// of the given class.
llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD);