From e2cb8d198f54b84187419a23b3f3e1d05015e5e7 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 7 Jul 2014 06:20:47 +0000 Subject: CodeGen: Refactor RTTI emission Let's not expose ABI specific minutia inside of CodeGenModule and Type. Instead, let's abstract it through CXXABI. This gets rid of: CodeGenModule::getCompleteObjectLocator, CodeGenModule::EmitFundamentalTypeDescriptor{s,}, CodeGenModule::getMSTypeDescriptor, CodeGenModule::getMSCompleteObjectLocator, CGCXXABI::shouldRTTIBeUnique, CGCXXABI::classifyRTTIUniqueness. CGRTTI was *almost* entirely centered around providing Itanium-style RTTI information. Instead of providing interfaces that only it consumes, move it to the ItaniumCXXABI implementation file. This allows it to have access to Itanium-specific implementation details without providing useless expansion points for the Microsoft ABI side. Differential Revision: http://reviews.llvm.org/D4261 llvm-svn: 212435 --- clang/lib/CodeGen/CGCXXABI.h | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'clang/lib/CodeGen/CGCXXABI.h') diff --git a/clang/lib/CodeGen/CGCXXABI.h b/clang/lib/CodeGen/CGCXXABI.h index 0a31d2aa121..b49c68a4df1 100644 --- a/clang/lib/CodeGen/CGCXXABI.h +++ b/clang/lib/CodeGen/CGCXXABI.h @@ -207,6 +207,8 @@ public: llvm::Value *ptr, QualType type) = 0; + virtual llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) = 0; + virtual bool shouldTypeidBeNullChecked(bool IsDeref, QualType SrcRecordTy) = 0; virtual void EmitBadTypeidCall(CodeGenFunction &CGF) = 0; @@ -516,36 +518,6 @@ public: virtual LValue EmitThreadLocalVarDeclLValue(CodeGenFunction &CGF, const VarDecl *VD, QualType LValType); - - /**************************** RTTI Uniqueness ******************************/ - -protected: - /// Returns true if the ABI requires RTTI type_info objects to be unique - /// across a program. - virtual bool shouldRTTIBeUnique() { return true; } - -public: - /// What sort of unique-RTTI behavior should we use? - enum RTTIUniquenessKind { - /// We are guaranteeing, or need to guarantee, that the RTTI string - /// is unique. - RUK_Unique, - - /// We are not guaranteeing uniqueness for the RTTI string, so we - /// can demote to hidden visibility but must use string comparisons. - RUK_NonUniqueHidden, - - /// We are not guaranteeing uniqueness for the RTTI string, so we - /// have to use string comparisons, but we also have to emit it with - /// non-hidden visibility. - RUK_NonUniqueVisible - }; - - /// Return the required visibility status for the given type and linkage in - /// the current ABI. - RTTIUniquenessKind - classifyRTTIUniqueness(QualType CanTy, - llvm::GlobalValue::LinkageTypes Linkage); }; // Create an instance of a C++ ABI class: -- cgit v1.2.3