clang API Documentation

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
clang::CodeGen::CGCXXABI Class Reference

Implements C++ ABI-specific code generation functions. More...

#include <CGCXXABI.h>

Collaboration diagram for clang::CodeGen::CGCXXABI:
Collaboration graph
[legend]

List of all members.

Public Types

enum  RecordArgABI { RAA_Default = 0, RAA_DirectInMemory, RAA_Indirect }
 Specify how one should pass an argument of a record type. More...

Public Member Functions

virtual ~CGCXXABI ()
MangleContextgetMangleContext ()
 Gets the mangle context.
virtual bool HasThisReturn (GlobalDecl GD) const
virtual bool hasMostDerivedReturn (GlobalDecl GD) const
virtual bool classifyReturnType (CGFunctionInfo &FI) const =0
bool canCopyArgument (const CXXRecordDecl *RD) const
virtual RecordArgABI getRecordArgABI (const CXXRecordDecl *RD) const =0
 Returns how an argument of the given record type should be passed.
virtual bool isSRetParameterAfterThis () const
virtual llvm::Type * ConvertMemberPointerType (const MemberPointerType *MPT)
virtual llvm::ValueEmitLoadOfMemberFunctionPointer (CodeGenFunction &CGF, const Expr *E, llvm::Value *&This, llvm::Value *MemPtr, const MemberPointerType *MPT)
virtual llvm::ValueEmitMemberDataPointerAddress (CodeGenFunction &CGF, const Expr *E, llvm::Value *Base, llvm::Value *MemPtr, const MemberPointerType *MPT)
 Calculate an l-value from an object and a data member pointer.
virtual llvm::ValueEmitMemberPointerConversion (CodeGenFunction &CGF, const CastExpr *E, llvm::Value *Src)
virtual llvm::Constant * EmitMemberPointerConversion (const CastExpr *E, llvm::Constant *Src)
virtual bool isZeroInitializable (const MemberPointerType *MPT)
virtual bool isMemberPointerConvertible (const MemberPointerType *MPT) const
 Return whether or not a member pointers type is convertible to an IR type.
virtual bool isTypeInfoCalculable (QualType Ty) const
virtual llvm::Constant * EmitNullMemberPointer (const MemberPointerType *MPT)
 Create a null member pointer of the given type.
virtual llvm::Constant * EmitMemberPointer (const CXXMethodDecl *MD)
 Create a member pointer for the given method.
virtual llvm::Constant * EmitMemberDataPointer (const MemberPointerType *MPT, CharUnits offset)
 Create a member pointer for the given field.
virtual llvm::Constant * EmitMemberPointer (const APValue &MP, QualType MPT)
 Create a member pointer for the given member pointer constant.
virtual llvm::ValueEmitMemberPointerComparison (CodeGenFunction &CGF, llvm::Value *L, llvm::Value *R, const MemberPointerType *MPT, bool Inequality)
 Emit a comparison between two member pointers. Returns an i1.
virtual llvm::ValueEmitMemberPointerIsNotNull (CodeGenFunction &CGF, llvm::Value *MemPtr, const MemberPointerType *MPT)
 Determine if a member pointer is non-null. Returns an i1.
virtual void emitVirtualObjectDelete (CodeGenFunction &CGF, const CXXDeleteExpr *DE, llvm::Value *Ptr, QualType ElementType, const CXXDestructorDecl *Dtor)=0
virtual llvm::Constant * getAddrOfRTTIDescriptor (QualType Ty)=0
virtual bool shouldTypeidBeNullChecked (bool IsDeref, QualType SrcRecordTy)=0
virtual void EmitBadTypeidCall (CodeGenFunction &CGF)=0
virtual llvm::ValueEmitTypeid (CodeGenFunction &CGF, QualType SrcRecordTy, llvm::Value *ThisPtr, llvm::Type *StdTypeInfoPtrTy)=0
virtual bool shouldDynamicCastCallBeNullChecked (bool SrcIsPtr, QualType SrcRecordTy)=0
virtual llvm::ValueEmitDynamicCastCall (CodeGenFunction &CGF, llvm::Value *Value, QualType SrcRecordTy, QualType DestTy, QualType DestRecordTy, llvm::BasicBlock *CastEnd)=0
virtual llvm::ValueEmitDynamicCastToVoid (CodeGenFunction &CGF, llvm::Value *Value, QualType SrcRecordTy, QualType DestTy)=0
virtual bool EmitBadCastCall (CodeGenFunction &CGF)=0
virtual llvm::ValueGetVirtualBaseClassOffset (CodeGenFunction &CGF, llvm::Value *This, const CXXRecordDecl *ClassDecl, const CXXRecordDecl *BaseClassDecl)=0
virtual llvm::BasicBlock * EmitCtorCompleteObjectHandler (CodeGenFunction &CGF, const CXXRecordDecl *RD)
virtual void initializeHiddenVirtualInheritanceMembers (CodeGenFunction &CGF, const CXXRecordDecl *RD)
virtual void EmitCXXConstructors (const CXXConstructorDecl *D)=0
 Emit constructor variants required by this ABI.
virtual void buildStructorSignature (const CXXMethodDecl *MD, StructorType T, SmallVectorImpl< CanQualType > &ArgTys)=0
virtual bool useThunkForDtorVariant (const CXXDestructorDecl *Dtor, CXXDtorType DT) const =0
virtual void EmitCXXDestructors (const CXXDestructorDecl *D)=0
 Emit destructor variants required by this ABI.
virtual const CXXRecordDeclgetThisArgumentTypeForMethod (const CXXMethodDecl *MD)
virtual llvm::ValueadjustThisArgumentForVirtualFunctionCall (CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This, bool VirtualCall)
void buildThisParam (CodeGenFunction &CGF, FunctionArgList &Params)
 Build a parameter variable suitable for 'this'.
virtual void addImplicitStructorParams (CodeGenFunction &CGF, QualType &ResTy, FunctionArgList &Params)=0
virtual llvm::ValueadjustThisParameterInVirtualFunctionPrologue (CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This)
virtual void EmitInstanceFunctionProlog (CodeGenFunction &CGF)=0
 Emit the ABI-specific prolog for the function.
virtual unsigned addImplicitConstructorArgs (CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, CallArgList &Args)=0
virtual void EmitDestructorCall (CodeGenFunction &CGF, const CXXDestructorDecl *DD, CXXDtorType Type, bool ForVirtualBase, bool Delegating, llvm::Value *This)=0
 Emit the destructor call.
virtual void emitVTableDefinitions (CodeGenVTables &CGVT, const CXXRecordDecl *RD)=0
 Emits the VTable definitions required for the given record type.
virtual llvm::ValuegetVTableAddressPointInStructor (CodeGenFunction &CGF, const CXXRecordDecl *RD, BaseSubobject Base, const CXXRecordDecl *NearestVBase, bool &NeedsVirtualOffset)=0
virtual llvm::Constant * getVTableAddressPointForConstExpr (BaseSubobject Base, const CXXRecordDecl *VTableClass)=0
virtual llvm::GlobalVariable * getAddrOfVTable (const CXXRecordDecl *RD, CharUnits VPtrOffset)=0
virtual llvm::ValuegetVirtualFunctionPointer (CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This, llvm::Type *Ty)=0
 Build a virtual function pointer in the ABI-specific way.
virtual llvm::ValueEmitVirtualDestructorCall (CodeGenFunction &CGF, const CXXDestructorDecl *Dtor, CXXDtorType DtorType, llvm::Value *This, const CXXMemberCallExpr *CE)=0
 Emit the ABI-specific virtual destructor call.
virtual void adjustCallArgsForDestructorThunk (CodeGenFunction &CGF, GlobalDecl GD, CallArgList &CallArgs)
virtual void emitVirtualInheritanceTables (const CXXRecordDecl *RD)=0
virtual void setThunkLinkage (llvm::Function *Thunk, bool ForVTable, GlobalDecl GD, bool ReturnAdjustment)=0
virtual llvm::ValueperformThisAdjustment (CodeGenFunction &CGF, llvm::Value *This, const ThisAdjustment &TA)=0
virtual llvm::ValueperformReturnAdjustment (CodeGenFunction &CGF, llvm::Value *Ret, const ReturnAdjustment &RA)=0
virtual void EmitReturnFromThunk (CodeGenFunction &CGF, RValue RV, QualType ResultType)
virtual size_t getSrcArgforCopyCtor (const CXXConstructorDecl *, FunctionArgList &Args) const =0
virtual StringRef GetPureVirtualCallName ()=0
 Gets the pure virtual member call function.
virtual StringRef GetDeletedVirtualCallName ()=0
 Gets the deleted virtual member call name.
virtual CharUnits GetArrayCookieSize (const CXXNewExpr *expr)
virtual llvm::ValueInitializeArrayCookie (CodeGenFunction &CGF, llvm::Value *NewPtr, llvm::Value *NumElements, const CXXNewExpr *expr, QualType ElementType)
virtual void ReadArrayCookie (CodeGenFunction &CGF, llvm::Value *Ptr, const CXXDeleteExpr *expr, QualType ElementType, llvm::Value *&NumElements, llvm::Value *&AllocPtr, CharUnits &CookieSize)
virtual bool NeedsVTTParameter (GlobalDecl GD)
 Return whether the given global decl needs a VTT parameter.
virtual void EmitGuardedInit (CodeGenFunction &CGF, const VarDecl &D, llvm::GlobalVariable *DeclPtr, bool PerformInit)=0
virtual void registerGlobalDtor (CodeGenFunction &CGF, const VarDecl &D, llvm::Constant *Dtor, llvm::Constant *Addr)=0
virtual void EmitThreadLocalInitFuncs (CodeGenModule &CGM, ArrayRef< std::pair< const VarDecl *, llvm::GlobalVariable * >> CXXThreadLocals, ArrayRef< llvm::Function * > CXXThreadLocalInits, ArrayRef< llvm::GlobalVariable * > CXXThreadLocalInitVars)=0
virtual bool usesThreadWrapperFunction () const =0
virtual LValue EmitThreadLocalVarDeclLValue (CodeGenFunction &CGF, const VarDecl *VD, QualType LValType)=0
virtual void emitCXXStructor (const CXXMethodDecl *MD, StructorType Type)=0

Protected Member Functions

 CGCXXABI (CodeGenModule &CGM)
ImplicitParamDecl *& getThisDecl (CodeGenFunction &CGF)
llvm::Value *& getThisValue (CodeGenFunction &CGF)
void ErrorUnsupportedABI (CodeGenFunction &CGF, StringRef S)
 Issue a diagnostic about unsupported features in the ABI.
llvm::Constant * GetBogusMemberPointer (QualType T)
 Get a null value for unsupported member pointers.
ImplicitParamDecl *& getStructorImplicitParamDecl (CodeGenFunction &CGF)
llvm::Value *& getStructorImplicitParamValue (CodeGenFunction &CGF)
void EmitThisParam (CodeGenFunction &CGF)
ASTContextgetContext () const
virtual bool requiresArrayCookie (const CXXDeleteExpr *E, QualType eltType)
virtual bool requiresArrayCookie (const CXXNewExpr *E)
llvm::Constant * getMemberPointerAdjustment (const CastExpr *E)
CharUnits getMemberPointerPathAdjustment (const APValue &MP)
 Computes the non-virtual adjustment needed for a member pointer conversion along an inheritance path stored in an APValue. Unlike getMemberPointerAdjustment(), the adjustment can be negative if the path is from a derived type to a base type.
virtual CharUnits getArrayCookieSizeImpl (QualType elementType)
virtual llvm::ValuereadArrayCookieImpl (CodeGenFunction &IGF, llvm::Value *ptr, CharUnits cookieSize)

Protected Attributes

CodeGenModuleCGM
std::unique_ptr< MangleContextMangleCtx

Detailed Description

Implements C++ ABI-specific code generation functions.

Definition at line 41 of file CGCXXABI.h.


Member Enumeration Documentation

Specify how one should pass an argument of a record type.

Enumerator:
RAA_Default 

Pass it using the normal C aggregate rules for the ABI, potentially introducing extra copies and passing some or all of it in registers.

RAA_DirectInMemory 

Pass it on the stack using its defined layout. The argument must be evaluated directly into the correct stack position in the arguments area, and the call machinery must not move it or introduce extra copies.

RAA_Indirect 

Pass it as a pointer to temporary memory.

Definition at line 103 of file CGCXXABI.h.


Constructor & Destructor Documentation

clang::CodeGen::CGCXXABI::CGCXXABI ( CodeGenModule CGM) [inline, protected]

Definition at line 46 of file CGCXXABI.h.

CGCXXABI::~CGCXXABI ( ) [virtual]

Definition at line 20 of file CGCXXABI.cpp.


Member Function Documentation

virtual unsigned clang::CodeGen::CGCXXABI::addImplicitConstructorArgs ( CodeGenFunction CGF,
const CXXConstructorDecl D,
CXXCtorType  Type,
bool  ForVirtualBase,
bool  Delegating,
CallArgList Args 
) [pure virtual]

Add any ABI-specific implicit arguments needed to call a constructor.

Returns:
The number of args added to the call, which is typically zero or one.

Referenced by clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall().

virtual void clang::CodeGen::CGCXXABI::addImplicitStructorParams ( CodeGenFunction CGF,
QualType ResTy,
FunctionArgList Params 
) [pure virtual]

Insert any ABI-specific implicit parameters into the parameter list for a function. This generally involves extra data for constructors and destructors.

ABIs may also choose to override the return type, which has been initialized with the type of 'this' if HasThisReturn(CGF.CurGD) is true or the formal return type of the function otherwise.

Referenced by clang::CodeGen::CodeGenFunction::GenerateCode(), and clang::CodeGen::CodeGenFunction::StartThunk().

virtual void clang::CodeGen::CGCXXABI::adjustCallArgsForDestructorThunk ( CodeGenFunction CGF,
GlobalDecl  GD,
CallArgList CallArgs 
) [inline, virtual]
virtual llvm::Value* clang::CodeGen::CGCXXABI::adjustThisArgumentForVirtualFunctionCall ( CodeGenFunction CGF,
GlobalDecl  GD,
llvm::Value This,
bool  VirtualCall 
) [inline, virtual]

Perform ABI-specific "this" argument adjustment required prior to a call of a virtual function. The "VirtualCall" argument is true iff the call itself is virtual.

Definition at line 286 of file CGCXXABI.h.

Referenced by clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr().

Perform ABI-specific "this" parameter adjustment in a virtual function prologue.

Definition at line 307 of file CGCXXABI.h.

virtual void clang::CodeGen::CGCXXABI::buildStructorSignature ( const CXXMethodDecl MD,
StructorType  T,
SmallVectorImpl< CanQualType > &  ArgTys 
) [pure virtual]

Build the signature of the given constructor or destructor variant by adding any required parameters. For convenience, ArgTys has been initialized with the type of 'this'.

Referenced by clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration().

Returns true if C++ allows us to copy the memory of an object of type RD when it is passed as an argument.

Definition at line 31 of file CGCXXABI.cpp.

References clang::CXXRecordDecl::ctors(), clang::CXXRecordDecl::hasNonTrivialCopyConstructor(), clang::CXXRecordDecl::hasNonTrivialDestructor(), and clang::CXXRecordDecl::hasNonTrivialMoveConstructor().

virtual bool clang::CodeGen::CGCXXABI::classifyReturnType ( CGFunctionInfo FI) const [pure virtual]

If the C++ ABI requires the given type be returned in a particular way, this method sets RetAI and returns true.

llvm::Type * CGCXXABI::ConvertMemberPointerType ( const MemberPointerType MPT) [virtual]

Referenced by EmitDynamicCastToNull().

virtual void clang::CodeGen::CGCXXABI::EmitBadTypeidCall ( CodeGenFunction CGF) [pure virtual]

Referenced by EmitTypeidFromVTable().

llvm::BasicBlock * CGCXXABI::EmitCtorCompleteObjectHandler ( CodeGenFunction CGF,
const CXXRecordDecl RD 
) [virtual]
virtual void clang::CodeGen::CGCXXABI::EmitCXXConstructors ( const CXXConstructorDecl D) [pure virtual]

Emit constructor variants required by this ABI.

Referenced by clang::CodeGen::CodeGenModule::EmitTopLevelDecl().

virtual void clang::CodeGen::CGCXXABI::EmitCXXDestructors ( const CXXDestructorDecl D) [pure virtual]

Emit destructor variants required by this ABI.

Referenced by clang::CodeGen::CodeGenModule::EmitTopLevelDecl().

virtual void clang::CodeGen::CGCXXABI::emitCXXStructor ( const CXXMethodDecl MD,
StructorType  Type 
) [pure virtual]

Emit a single constructor/destructor with the given type from a C++ constructor Decl.

virtual void clang::CodeGen::CGCXXABI::EmitDestructorCall ( CodeGenFunction CGF,
const CXXDestructorDecl DD,
CXXDtorType  Type,
bool  ForVirtualBase,
bool  Delegating,
llvm::Value This 
) [pure virtual]

Emit the destructor call.

Referenced by clang::CodeGen::CodeGenFunction::EmitCXXDestructorCall().

virtual llvm::Value* clang::CodeGen::CGCXXABI::EmitDynamicCastCall ( CodeGenFunction CGF,
llvm::Value Value,
QualType  SrcRecordTy,
QualType  DestTy,
QualType  DestRecordTy,
llvm::BasicBlock *  CastEnd 
) [pure virtual]
virtual llvm::Value* clang::CodeGen::CGCXXABI::EmitDynamicCastToVoid ( CodeGenFunction CGF,
llvm::Value Value,
QualType  SrcRecordTy,
QualType  DestTy 
) [pure virtual]
virtual void clang::CodeGen::CGCXXABI::EmitGuardedInit ( CodeGenFunction CGF,
const VarDecl D,
llvm::GlobalVariable *  DeclPtr,
bool  PerformInit 
) [pure virtual]

Emits the guarded initializer and destructor setup for the given variable, given that it couldn't be emitted as a constant. If PerformInit is false, the initialization has been folded to a constant and should not be performed.

The variable may be:

  • a static local variable
  • a static data member of a class template instantiation

Referenced by clang::CodeGen::CodeGenFunction::EmitCXXGuardedInit().

Emit the ABI-specific prolog for the function.

Referenced by clang::CodeGen::CodeGenFunction::StartFunction(), and clang::CodeGen::CodeGenFunction::StartThunk().

llvm::Value * CGCXXABI::EmitLoadOfMemberFunctionPointer ( CodeGenFunction CGF,
const Expr E,
llvm::Value *&  This,
llvm::Value MemPtr,
const MemberPointerType MPT 
) [virtual]
llvm::Constant * CGCXXABI::EmitMemberDataPointer ( const MemberPointerType MPT,
CharUnits  offset 
) [virtual]

Create a member pointer for the given field.

Definition at line 139 of file CGCXXABI.cpp.

References GetBogusMemberPointer().

Referenced by clang::CodeGen::CodeGenModule::getMemberPointerConstant().

llvm::Value * CGCXXABI::EmitMemberDataPointerAddress ( CodeGenFunction CGF,
const Expr E,
llvm::Value Base,
llvm::Value MemPtr,
const MemberPointerType MPT 
) [virtual]
llvm::Constant * CGCXXABI::EmitMemberPointer ( const CXXMethodDecl MD) [virtual]
llvm::Constant * CGCXXABI::EmitMemberPointer ( const APValue MP,
QualType  MPT 
) [virtual]

Create a member pointer for the given member pointer constant.

Definition at line 144 of file CGCXXABI.cpp.

References GetBogusMemberPointer().

llvm::Value * CGCXXABI::EmitMemberPointerComparison ( CodeGenFunction CGF,
llvm::Value L,
llvm::Value R,
const MemberPointerType MPT,
bool  Inequality 
) [virtual]

Emit a comparison between two member pointers. Returns an i1.

Definition at line 111 of file CGCXXABI.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and ErrorUnsupportedABI().

Perform a derived-to-base, base-to-derived, or bitcast member pointer conversion.

Definition at line 98 of file CGCXXABI.cpp.

References ErrorUnsupportedABI(), GetBogusMemberPointer(), and clang::Expr::getType().

llvm::Constant * CGCXXABI::EmitMemberPointerConversion ( const CastExpr E,
llvm::Constant *  Src 
) [virtual]

Perform a derived-to-base, base-to-derived, or bitcast member pointer conversion on a constant value.

Definition at line 105 of file CGCXXABI.cpp.

References GetBogusMemberPointer(), and clang::Expr::getType().

Determine if a member pointer is non-null. Returns an i1.

Definition at line 121 of file CGCXXABI.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and ErrorUnsupportedABI().

Referenced by clang::CodeGen::CodeGenFunction::EvaluateExprAsBool().

llvm::Constant * CGCXXABI::EmitNullMemberPointer ( const MemberPointerType MPT) [virtual]

Create a null member pointer of the given type.

Definition at line 129 of file CGCXXABI.cpp.

References GetBogusMemberPointer().

Referenced by clang::CodeGen::CodeGenModule::EmitNullConstant().

void CGCXXABI::EmitReturnFromThunk ( CodeGenFunction CGF,
RValue  RV,
QualType  ResultType 
) [virtual]
void CGCXXABI::EmitThisParam ( CodeGenFunction CGF) [protected]

Perform prolog initialization of the parameter variable suitable for 'this' emitted by buildThisParam.

Initialize the 'this' slot.

Definition at line 166 of file CGCXXABI.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), getThisDecl(), and getThisValue().

virtual void clang::CodeGen::CGCXXABI::EmitThreadLocalInitFuncs ( CodeGenModule CGM,
ArrayRef< std::pair< const VarDecl *, llvm::GlobalVariable * >>  CXXThreadLocals,
ArrayRef< llvm::Function * >  CXXThreadLocalInits,
ArrayRef< llvm::GlobalVariable * >  CXXThreadLocalInitVars 
) [pure virtual]

Emits ABI-required functions necessary to initialize thread_local variables in this translation unit.

Parameters:
CXXThreadLocals- The thread_local declarations in this translation unit.
CXXThreadLocalInits- If this translation unit contains any non-constant initialization or non-trivial destruction for thread_local variables, a list of functions to perform the initialization.
virtual LValue clang::CodeGen::CGCXXABI::EmitThreadLocalVarDeclLValue ( CodeGenFunction CGF,
const VarDecl VD,
QualType  LValType 
) [pure virtual]

Emit a reference to a non-local thread_local variable (including triggering the initialization of all thread_local variables in its translation unit).

Referenced by EmitGlobalVarDeclLValue().

virtual llvm::Value* clang::CodeGen::CGCXXABI::EmitTypeid ( CodeGenFunction CGF,
QualType  SrcRecordTy,
llvm::Value ThisPtr,
llvm::Type *  StdTypeInfoPtrTy 
) [pure virtual]

Referenced by EmitTypeidFromVTable().

virtual llvm::Value* clang::CodeGen::CGCXXABI::EmitVirtualDestructorCall ( CodeGenFunction CGF,
const CXXDestructorDecl Dtor,
CXXDtorType  DtorType,
llvm::Value This,
const CXXMemberCallExpr CE 
) [pure virtual]

Emit the ABI-specific virtual destructor call.

Referenced by clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr().

virtual void clang::CodeGen::CGCXXABI::emitVirtualInheritanceTables ( const CXXRecordDecl RD) [pure virtual]

Emit any tables needed to implement virtual inheritance. For Itanium, this emits virtual table tables. For the MSVC++ ABI, this emits virtual base tables.

Referenced by clang::CodeGen::CodeGenVTables::GenerateClassData().

virtual void clang::CodeGen::CGCXXABI::emitVirtualObjectDelete ( CodeGenFunction CGF,
const CXXDeleteExpr DE,
llvm::Value Ptr,
QualType  ElementType,
const CXXDestructorDecl Dtor 
) [pure virtual]

Referenced by EmitObjectDelete().

virtual void clang::CodeGen::CGCXXABI::emitVTableDefinitions ( CodeGenVTables CGVT,
const CXXRecordDecl RD 
) [pure virtual]

Emits the VTable definitions required for the given record type.

Referenced by clang::CodeGen::CodeGenVTables::GenerateClassData().

void CGCXXABI::ErrorUnsupportedABI ( CodeGenFunction CGF,
StringRef  S 
) [protected]
virtual llvm::Constant* clang::CodeGen::CGCXXABI::getAddrOfRTTIDescriptor ( QualType  Ty) [pure virtual]
virtual llvm::GlobalVariable* clang::CodeGen::CGCXXABI::getAddrOfVTable ( const CXXRecordDecl RD,
CharUnits  VPtrOffset 
) [pure virtual]

Get the address of the vtable for the given record decl which should be used for the vptr at the given offset in RD.

Referenced by BuildAppleKextVirtualCall(), clang::CodeGen::CodeGenVTables::GetAddrOfVTT(), and GetAddrOfVTTVTable().

CharUnits CGCXXABI::GetArrayCookieSize ( const CXXNewExpr expr) [virtual]

Returns the extra size required in order to store the array cookie for the given new-expression. May return 0 to indicate that no array cookie is required.

Several cases are filtered out before this method is called:

  • non-array allocations never need a cookie
  • calls to ::operator new(size_t, void*) never need a cookie
Parameters:
expr- the new-expression being allocated.

Definition at line 179 of file CGCXXABI.cpp.

References clang::CXXNewExpr::getAllocatedType(), getArrayCookieSizeImpl(), requiresArrayCookie(), and clang::CharUnits::Zero().

Referenced by CalculateCookiePadding().

CharUnits CGCXXABI::getArrayCookieSizeImpl ( QualType  elementType) [protected, virtual]

Returns the extra size required in order to store the array cookie for the given type. Assumes that an array cookie is required.

Definition at line 185 of file CGCXXABI.cpp.

References clang::CharUnits::Zero().

Referenced by GetArrayCookieSize(), and ReadArrayCookie().

llvm::Constant * CGCXXABI::GetBogusMemberPointer ( QualType  T) [protected]
ASTContext& clang::CodeGen::CGCXXABI::getContext ( ) const [inline, protected]

Definition at line 74 of file CGCXXABI.h.

References CGM, and clang::CodeGen::CodeGenModule::getContext().

Referenced by getMemberPointerPathAdjustment().

virtual StringRef clang::CodeGen::CGCXXABI::GetDeletedVirtualCallName ( ) [pure virtual]

Gets the deleted virtual member call name.

Referenced by clang::CodeGen::CodeGenVTables::CreateVTableInitializer().

llvm::Constant * CGCXXABI::getMemberPointerAdjustment ( const CastExpr E) [protected]

A utility method for computing the offset required for the given base-to-derived or derived-to-base member-pointer conversion. Does not handle virtual conversions (in case we ever fully support an ABI that allows this). Returns null if no adjustment is required.

Returns the adjustment, in bytes, required for the given member-pointer operation. Returns null if no adjustment is required.

Definition at line 252 of file CGCXXABI.cpp.

References CGM, clang::CK_BaseToDerivedMemberPointer, clang::CK_DerivedToBaseMemberPointer, clang::Type::getAsCXXRecordDecl(), clang::CastExpr::getCastKind(), clang::CodeGen::CodeGenModule::GetNonVirtualBaseClassOffset(), clang::CastExpr::getSubExpr(), clang::Expr::getType(), clang::CastExpr::path_begin(), and clang::CastExpr::path_end().

Computes the non-virtual adjustment needed for a member pointer conversion along an inheritance path stored in an APValue. Unlike getMemberPointerAdjustment(), the adjustment can be negative if the path is from a derived type to a base type.

Definition at line 270 of file CGCXXABI.cpp.

References clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), getContext(), clang::Decl::getDeclContext(), clang::APValue::getMemberPointerDecl(), clang::APValue::getMemberPointerPath(), clang::APValue::isMemberPointerToDerivedMember(), and clang::CharUnits::Zero().

virtual StringRef clang::CodeGen::CGCXXABI::GetPureVirtualCallName ( ) [pure virtual]

Gets the pure virtual member call function.

Referenced by clang::CodeGen::CodeGenVTables::CreateVTableInitializer().

virtual RecordArgABI clang::CodeGen::CGCXXABI::getRecordArgABI ( const CXXRecordDecl RD) const [pure virtual]

Returns how an argument of the given record type should be passed.

Referenced by clang::CodeGen::CodeGenFunction::EmitCallArg(), getRecordArgABI(), and isInAllocaArgument().

virtual size_t clang::CodeGen::CGCXXABI::getSrcArgforCopyCtor ( const CXXConstructorDecl ,
FunctionArgList Args 
) const [pure virtual]

Referenced by EmitMemberInitializer().

Definition at line 63 of file CGCXXABI.h.

Definition at line 66 of file CGCXXABI.h.

Get the type of the implicit "this" parameter used by a method. May return zero if no specific type is applicable, e.g. if the ABI expects the "this" parameter to point to some artificial offset in a complete object due to vbases being reordered.

Definition at line 278 of file CGCXXABI.h.

References clang::CXXMethodDecl::getParent().

Referenced by clang::CodeGen::CodeGenTypes::arrangeCXXMethodDeclaration().

Definition at line 50 of file CGCXXABI.h.

Referenced by buildThisParam(), and EmitThisParam().

Definition at line 53 of file CGCXXABI.h.

Referenced by EmitThisParam().

virtual llvm::Value* clang::CodeGen::CGCXXABI::GetVirtualBaseClassOffset ( CodeGenFunction CGF,
llvm::Value This,
const CXXRecordDecl ClassDecl,
const CXXRecordDecl BaseClassDecl 
) [pure virtual]
virtual llvm::Value* clang::CodeGen::CGCXXABI::getVirtualFunctionPointer ( CodeGenFunction CGF,
GlobalDecl  GD,
llvm::Value This,
llvm::Type *  Ty 
) [pure virtual]

Build a virtual function pointer in the ABI-specific way.

Referenced by clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(), and clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallee().

virtual llvm::Constant* clang::CodeGen::CGCXXABI::getVTableAddressPointForConstExpr ( BaseSubobject  Base,
const CXXRecordDecl VTableClass 
) [pure virtual]

Get the address point of the vtable for the given base subobject while building a constexpr.

virtual llvm::Value* clang::CodeGen::CGCXXABI::getVTableAddressPointInStructor ( CodeGenFunction CGF,
const CXXRecordDecl RD,
BaseSubobject  Base,
const CXXRecordDecl NearestVBase,
bool NeedsVirtualOffset 
) [pure virtual]

Get the address point of the vtable for the given base subobject while building a constructor or a destructor. On return, NeedsVirtualOffset tells if a virtual base adjustment is needed in order to get the offset of the base subobject.

Referenced by clang::CodeGen::CodeGenFunction::InitializeVTablePointer().

virtual bool clang::CodeGen::CGCXXABI::hasMostDerivedReturn ( GlobalDecl  GD) const [inline, virtual]
virtual bool clang::CodeGen::CGCXXABI::HasThisReturn ( GlobalDecl  GD) const [inline, virtual]

Returns true if the given constructor or destructor is one of the kinds that the ABI says returns 'this' (only applies when called non-virtually for destructors).

There currently is no way to indicate if a destructor returns 'this' when called virtually, and code generation does not support the case.

Definition at line 94 of file CGCXXABI.h.

Referenced by clang::CodeGen::CodeGenTypes::arrangeCXXConstructorCall(), clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration(), clang::CodeGen::CodeGenFunction::EmitCallAndReturnForThunk(), clang::CodeGen::CodeGenFunction::GenerateCode(), and clang::CodeGen::CodeGenFunction::StartThunk().

llvm::Value * CGCXXABI::InitializeArrayCookie ( CodeGenFunction CGF,
llvm::Value NewPtr,
llvm::Value NumElements,
const CXXNewExpr expr,
QualType  ElementType 
) [virtual]

Initialize the array cookie for the given allocation.

Parameters:
NewPtr- a char* which is the presumed-non-null return value of the allocation function
NumElements- the computed number of elements, potentially collapsed from the multidimensional array case; always a size_t
ElementType- the base element allocated type, i.e. the allocated type after stripping all array types

Definition at line 190 of file CGCXXABI.cpp.

References ErrorUnsupportedABI().

Referenced by clang::CodeGen::CodeGenFunction::EmitCXXNewExpr().

Emit the code to initialize hidden members required to handle virtual inheritance, if needed by the ABI.

Definition at line 252 of file CGCXXABI.h.

Referenced by clang::CodeGen::CodeGenFunction::InitializeVTablePointers().

virtual bool clang::CodeGen::CGCXXABI::isMemberPointerConvertible ( const MemberPointerType MPT) const [inline, virtual]

Return whether or not a member pointers type is convertible to an IR type.

Definition at line 162 of file CGCXXABI.h.

Referenced by clang::CodeGen::CodeGenTypes::isFuncParamTypeConvertible().

virtual bool clang::CodeGen::CGCXXABI::isSRetParameterAfterThis ( ) const [inline, virtual]

Returns true if the implicit 'sret' parameter comes after the implicit 'this' parameter of C++ instance methods.

Definition at line 126 of file CGCXXABI.h.

virtual bool clang::CodeGen::CGCXXABI::isTypeInfoCalculable ( QualType  Ty) const [inline, virtual]

Return true if the given member pointer can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer.

Definition at line 148 of file CGCXXABI.cpp.

Referenced by clang::CodeGen::CodeGenTypes::isZeroInitializable().

Return whether the given global decl needs a VTT parameter.

Definition at line 302 of file CGCXXABI.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitDelegateCXXConstructorCall(), and clang::CodeGen::CodeGenFunction::GetVTTParameter().

Referenced by PerformReturnAdjustment().

virtual llvm::Value* clang::CodeGen::CGCXXABI::performThisAdjustment ( CodeGenFunction CGF,
llvm::Value This,
const ThisAdjustment TA 
) [pure virtual]
void CGCXXABI::ReadArrayCookie ( CodeGenFunction CGF,
llvm::Value Ptr,
const CXXDeleteExpr expr,
QualType  ElementType,
llvm::Value *&  NumElements,
llvm::Value *&  AllocPtr,
CharUnits CookieSize 
) [virtual]

Reads the array cookie associated with the given pointer, if it has one.

Parameters:
Ptr- a pointer to the first element in the array
ElementType- the base element type of elements of the array
NumElements- an out parameter which will be initialized with the number of elements allocated, or zero if there is no cookie
AllocPtr- an out parameter which will be initialized with a char* pointing to the address returned by the allocation function
CookieSize- an out parameter which will be initialized with the size of the cookie, or zero if there is no cookie

Definition at line 219 of file CGCXXABI.cpp.

References clang::CodeGen::CodeGenFunction::Builder, getArrayCookieSizeImpl(), clang::CharUnits::getQuantity(), clang::CodeGen::CodeGenTypeCache::Int8Ty, readArrayCookieImpl(), requiresArrayCookie(), and clang::CharUnits::Zero().

Referenced by EmitArrayDelete().

llvm::Value * CGCXXABI::readArrayCookieImpl ( CodeGenFunction IGF,
llvm::Value ptr,
CharUnits  cookieSize 
) [protected, virtual]

Reads the array cookie for an allocation which is known to have one. This is called by the standard implementation of ReadArrayCookie.

Parameters:
ptr- a pointer to the allocation made for an array, as a char*
cookieSize- the computed cookie size of an array

Other parameters are as above.

Returns:
a size_t

Definition at line 242 of file CGCXXABI.cpp.

References ErrorUnsupportedABI(), and clang::CodeGen::CodeGenTypeCache::SizeTy.

Referenced by ReadArrayCookie().

virtual void clang::CodeGen::CGCXXABI::registerGlobalDtor ( CodeGenFunction CGF,
const VarDecl D,
llvm::Constant *  Dtor,
llvm::Constant *  Addr 
) [pure virtual]

Emit code to force the execution of a destructor during global teardown. The default implementation of this uses atexit.

Parameters:
Dtor- a function taking a single pointer argument
Addr- a pointer to pass to the destructor function.

Referenced by EmitDeclDestroy(), and pushTemporaryCleanup().

bool CGCXXABI::requiresArrayCookie ( const CXXDeleteExpr E,
QualType  eltType 
) [protected, virtual]
bool CGCXXABI::requiresArrayCookie ( const CXXNewExpr E) [protected, virtual]
virtual void clang::CodeGen::CGCXXABI::setThunkLinkage ( llvm::Function *  Thunk,
bool  ForVTable,
GlobalDecl  GD,
bool  ReturnAdjustment 
) [pure virtual]
virtual bool clang::CodeGen::CGCXXABI::shouldDynamicCastCallBeNullChecked ( bool  SrcIsPtr,
QualType  SrcRecordTy 
) [pure virtual]
virtual bool clang::CodeGen::CGCXXABI::shouldTypeidBeNullChecked ( bool  IsDeref,
QualType  SrcRecordTy 
) [pure virtual]

Referenced by EmitTypeidFromVTable().

Referenced by EmitGlobalVarDeclLValue().

virtual bool clang::CodeGen::CGCXXABI::useThunkForDtorVariant ( const CXXDestructorDecl Dtor,
CXXDtorType  DT 
) const [pure virtual]

Returns true if the given destructor type should be emitted as a linkonce delegating thunk, regardless of whether the dtor is defined in this TU or not.


Member Data Documentation

std::unique_ptr<MangleContext> clang::CodeGen::CGCXXABI::MangleCtx [protected]

Definition at line 44 of file CGCXXABI.h.

Referenced by getMangleContext().


The documentation for this class was generated from the following files: