clang 20.0.0git
|
Implements C++ ABI-specific code generation functions. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/CGCXXABI.h"
Classes | |
struct | AddedStructorArgCounts |
Similar to AddedStructorArgs, but only notes the number of additional arguments. More... | |
struct | AddedStructorArgs |
Additional implicit arguments to add to the beginning (Prefix) and end (Suffix) of a constructor / destructor arg list. More... | |
Public Types | |
enum | RecordArgABI { RAA_Default = 0 , RAA_DirectInMemory , RAA_Indirect } |
Specify how one should pass an argument of a record type. More... | |
using | DeleteOrMemberCallExpr = llvm::PointerUnion< const CXXDeleteExpr *, const CXXMemberCallExpr * > |
Public Member Functions | |
virtual | ~CGCXXABI () |
MangleContext & | getMangleContext () |
Gets the mangle context. | |
virtual bool | HasThisReturn (GlobalDecl GD) const |
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). | |
virtual bool | hasMostDerivedReturn (GlobalDecl GD) const |
virtual bool | useSinitAndSterm () const |
virtual bool | canCallMismatchedFunctionType () const |
Returns true if the target allows calling a function through a pointer with a different signature than the actual function (or equivalently, bitcasting a function or function pointer to a different function type). | |
virtual bool | classifyReturnType (CGFunctionInfo &FI) const =0 |
If the C++ ABI requires the given type be returned in a particular way, this method sets RetAI and returns true. | |
virtual RecordArgABI | getRecordArgABI (const CXXRecordDecl *RD) const =0 |
Returns how an argument of the given record type should be passed. | |
virtual bool | isSRetParameterAfterThis () const |
Returns true if the implicit 'sret' parameter comes after the implicit 'this' parameter of C++ instance methods. | |
virtual bool | isPermittedToBeHomogeneousAggregate (const CXXRecordDecl *RD) const |
Returns true if the ABI permits the argument to be a homogeneous aggregate. | |
virtual llvm::Type * | ConvertMemberPointerType (const MemberPointerType *MPT) |
Find the LLVM type used to represent the given member pointer type. | |
virtual CGCallee | EmitLoadOfMemberFunctionPointer (CodeGenFunction &CGF, const Expr *E, Address This, llvm::Value *&ThisPtrForCall, llvm::Value *MemPtr, const MemberPointerType *MPT) |
Load a member function from an object and a member function pointer. | |
virtual llvm::Value * | EmitMemberDataPointerAddress (CodeGenFunction &CGF, const Expr *E, Address Base, llvm::Value *MemPtr, const MemberPointerType *MPT) |
Calculate an l-value from an object and a data member pointer. | |
virtual llvm::Value * | EmitMemberPointerConversion (CodeGenFunction &CGF, const CastExpr *E, llvm::Value *Src) |
Perform a derived-to-base, base-to-derived, or bitcast member pointer conversion. | |
virtual llvm::Constant * | EmitMemberPointerConversion (const CastExpr *E, llvm::Constant *Src) |
Perform a derived-to-base, base-to-derived, or bitcast member pointer conversion on a constant value. | |
virtual bool | isZeroInitializable (const MemberPointerType *MPT) |
Return true if the given member pointer can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer. | |
virtual bool | isMemberPointerConvertible (const MemberPointerType *MPT) const |
Return whether or not a member pointers type is convertible to an IR type. | |
virtual llvm::Constant * | EmitNullMemberPointer (const MemberPointerType *MPT) |
Create a null member pointer of the given type. | |
virtual llvm::Constant * | EmitMemberFunctionPointer (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::Value * | EmitMemberPointerComparison (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::Value * | EmitMemberPointerIsNotNull (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, Address Ptr, QualType ElementType, const CXXDestructorDecl *Dtor)=0 |
virtual void | emitRethrow (CodeGenFunction &CGF, bool isNoReturn)=0 |
virtual void | emitThrow (CodeGenFunction &CGF, const CXXThrowExpr *E)=0 |
virtual llvm::GlobalVariable * | getThrowInfo (QualType T) |
virtual bool | canSpeculativelyEmitVTable (const CXXRecordDecl *RD) const =0 |
Determine whether it's possible to emit a vtable for RD , even though we do not know that the vtable has been marked as used by semantic analysis. | |
virtual void | emitBeginCatch (CodeGenFunction &CGF, const CXXCatchStmt *C)=0 |
virtual llvm::CallInst * | emitTerminateForUnexpectedException (CodeGenFunction &CGF, llvm::Value *Exn) |
virtual llvm::Constant * | getAddrOfRTTIDescriptor (QualType Ty)=0 |
virtual CatchTypeInfo | getAddrOfCXXCatchHandlerType (QualType Ty, QualType CatchHandlerType)=0 |
virtual CatchTypeInfo | getCatchAllTypeInfo () |
virtual bool | shouldTypeidBeNullChecked (QualType SrcRecordTy)=0 |
virtual void | EmitBadTypeidCall (CodeGenFunction &CGF)=0 |
virtual llvm::Value * | EmitTypeid (CodeGenFunction &CGF, QualType SrcRecordTy, Address ThisPtr, llvm::Type *StdTypeInfoPtrTy)=0 |
virtual bool | shouldDynamicCastCallBeNullChecked (bool SrcIsPtr, QualType SrcRecordTy)=0 |
virtual bool | shouldEmitExactDynamicCast (QualType DestRecordTy)=0 |
virtual llvm::Value * | emitDynamicCastCall (CodeGenFunction &CGF, Address Value, QualType SrcRecordTy, QualType DestTy, QualType DestRecordTy, llvm::BasicBlock *CastEnd)=0 |
virtual llvm::Value * | emitDynamicCastToVoid (CodeGenFunction &CGF, Address Value, QualType SrcRecordTy)=0 |
virtual llvm::Value * | emitExactDynamicCast (CodeGenFunction &CGF, Address Value, QualType SrcRecordTy, QualType DestTy, QualType DestRecordTy, llvm::BasicBlock *CastSuccess, llvm::BasicBlock *CastFail)=0 |
Emit a dynamic_cast from SrcRecordTy to DestRecordTy. | |
virtual bool | EmitBadCastCall (CodeGenFunction &CGF)=0 |
virtual llvm::Value * | GetVirtualBaseClassOffset (CodeGenFunction &CGF, Address 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) |
Emit the code to initialize hidden members required to handle virtual inheritance, if needed by the ABI. | |
virtual void | EmitCXXConstructors (const CXXConstructorDecl *D)=0 |
Emit constructor variants required by this ABI. | |
virtual AddedStructorArgCounts | buildStructorSignature (GlobalDecl GD, SmallVectorImpl< CanQualType > &ArgTys)=0 |
Build the signature of the given constructor or destructor variant by adding any required parameters. | |
virtual bool | useThunkForDtorVariant (const CXXDestructorDecl *Dtor, CXXDtorType DT) const =0 |
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. | |
virtual void | setCXXDestructorDLLStorage (llvm::GlobalValue *GV, const CXXDestructorDecl *Dtor, CXXDtorType DT) const |
virtual llvm::GlobalValue::LinkageTypes | getCXXDestructorLinkage (GVALinkage Linkage, const CXXDestructorDecl *Dtor, CXXDtorType DT) const |
virtual void | EmitCXXDestructors (const CXXDestructorDecl *D)=0 |
Emit destructor variants required by this ABI. | |
virtual const CXXRecordDecl * | getThisArgumentTypeForMethod (GlobalDecl GD) |
Get the type of the implicit "this" parameter used by a method. | |
virtual Address | adjustThisArgumentForVirtualFunctionCall (CodeGenFunction &CGF, GlobalDecl GD, Address This, bool VirtualCall) |
Perform ABI-specific "this" argument adjustment required prior to a call of a virtual function. | |
void | buildThisParam (CodeGenFunction &CGF, FunctionArgList &Params) |
Build a parameter variable suitable for 'this'. | |
virtual void | addImplicitStructorParams (CodeGenFunction &CGF, QualType &ResTy, FunctionArgList &Params)=0 |
Insert any ABI-specific implicit parameters into the parameter list for a function. | |
virtual CharUnits | getVirtualFunctionPrologueThisAdjustment (GlobalDecl GD) |
Get the ABI-specific "this" parameter adjustment to apply in the prologue of a virtual function. | |
virtual void | EmitInstanceFunctionProlog (CodeGenFunction &CGF)=0 |
Emit the ABI-specific prolog for the function. | |
virtual AddedStructorArgs | getImplicitConstructorArgs (CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating)=0 |
AddedStructorArgCounts | addImplicitConstructorArgs (CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, CallArgList &Args) |
Add any ABI-specific implicit arguments needed to call a constructor. | |
virtual llvm::Value * | getCXXDestructorImplicitParam (CodeGenFunction &CGF, const CXXDestructorDecl *DD, CXXDtorType Type, bool ForVirtualBase, bool Delegating)=0 |
Get the implicit (second) parameter that comes after the "this" pointer, or nullptr if there is isn't one. | |
virtual void | EmitDestructorCall (CodeGenFunction &CGF, const CXXDestructorDecl *DD, CXXDtorType Type, bool ForVirtualBase, bool Delegating, Address This, QualType ThisTy)=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 bool | isVirtualOffsetNeededForVTableField (CodeGenFunction &CGF, CodeGenFunction::VPtr Vptr)=0 |
Checks if ABI requires extra virtual offset for vtable field. | |
virtual bool | doStructorsInitializeVPtrs (const CXXRecordDecl *VTableClass)=0 |
Checks if ABI requires to initialize vptrs for given dynamic class. | |
virtual llvm::Constant * | getVTableAddressPoint (BaseSubobject Base, const CXXRecordDecl *VTableClass)=0 |
Get the address point of the vtable for the given base subobject. | |
virtual llvm::Value * | getVTableAddressPointInStructor (CodeGenFunction &CGF, const CXXRecordDecl *RD, BaseSubobject Base, const CXXRecordDecl *NearestVBase)=0 |
Get the address point of the vtable for the given base subobject while building a constructor or a destructor. | |
virtual llvm::GlobalVariable * | getAddrOfVTable (const CXXRecordDecl *RD, CharUnits VPtrOffset)=0 |
Get the address of the vtable for the given record decl which should be used for the vptr at the given offset in RD. | |
virtual CGCallee | getVirtualFunctionPointer (CodeGenFunction &CGF, GlobalDecl GD, Address This, llvm::Type *Ty, SourceLocation Loc)=0 |
Build a virtual function pointer in the ABI-specific way. | |
virtual llvm::Value * | EmitVirtualDestructorCall (CodeGenFunction &CGF, const CXXDestructorDecl *Dtor, CXXDtorType DtorType, Address This, DeleteOrMemberCallExpr E, llvm::CallBase **CallOrInvoke)=0 |
Emit the ABI-specific virtual destructor call. | |
virtual void | adjustCallArgsForDestructorThunk (CodeGenFunction &CGF, GlobalDecl GD, CallArgList &CallArgs) |
virtual void | emitVirtualInheritanceTables (const CXXRecordDecl *RD)=0 |
Emit any tables needed to implement virtual inheritance. | |
virtual bool | exportThunk ()=0 |
virtual void | setThunkLinkage (llvm::Function *Thunk, bool ForVTable, GlobalDecl GD, bool ReturnAdjustment)=0 |
virtual llvm::Value * | performThisAdjustment (CodeGenFunction &CGF, Address This, const CXXRecordDecl *UnadjustedClass, const ThunkInfo &TI)=0 |
virtual llvm::Value * | performReturnAdjustment (CodeGenFunction &CGF, Address Ret, const CXXRecordDecl *UnadjustedClass, const ReturnAdjustment &RA)=0 |
virtual void | EmitReturnFromThunk (CodeGenFunction &CGF, RValue RV, QualType ResultType) |
virtual size_t | getSrcArgforCopyCtor (const CXXConstructorDecl *, FunctionArgList &Args) const =0 |
virtual std::vector< CharUnits > | getVBPtrOffsets (const CXXRecordDecl *RD) |
Gets the offsets of all the virtual base pointers in a given class. | |
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) |
Returns the extra size required in order to store the array cookie for the given new-expression. | |
virtual Address | InitializeArrayCookie (CodeGenFunction &CGF, Address NewPtr, llvm::Value *NumElements, const CXXNewExpr *expr, QualType ElementType) |
Initialize the array cookie for the given allocation. | |
virtual void | ReadArrayCookie (CodeGenFunction &CGF, Address Ptr, const CXXDeleteExpr *expr, QualType ElementType, llvm::Value *&NumElements, llvm::Value *&AllocPtr, CharUnits &CookieSize) |
Reads the array cookie associated with the given pointer, if it has one. | |
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 |
Emits the guarded initializer and destructor setup for the given variable, given that it couldn't be emitted as a constant. | |
virtual void | registerGlobalDtor (CodeGenFunction &CGF, const VarDecl &D, llvm::FunctionCallee Dtor, llvm::Constant *Addr)=0 |
Emit code to force the execution of a destructor during global teardown. | |
virtual void | EmitThreadLocalInitFuncs (CodeGenModule &CGM, ArrayRef< const VarDecl * > CXXThreadLocals, ArrayRef< llvm::Function * > CXXThreadLocalInits, ArrayRef< const VarDecl * > CXXThreadLocalInitVars)=0 |
Emits ABI-required functions necessary to initialize thread_local variables in this translation unit. | |
virtual bool | usesThreadWrapperFunction (const VarDecl *VD) const =0 |
virtual LValue | EmitThreadLocalVarDeclLValue (CodeGenFunction &CGF, const VarDecl *VD, QualType LValType)=0 |
Emit a reference to a non-local thread_local variable (including triggering the initialization of all thread_local variables in its translation unit). | |
virtual void | emitCXXStructor (GlobalDecl GD)=0 |
Emit a single constructor/destructor with the given type from a C++ constructor Decl. | |
virtual std::pair< llvm::Value *, const CXXRecordDecl * > | LoadVTablePtr (CodeGenFunction &CGF, Address This, const CXXRecordDecl *RD)=0 |
Load a vtable from This, an object of polymorphic type RD, or from one of its virtual bases if it does not have its own vtable. | |
Protected Member Functions | |
CGCXXABI (CodeGenModule &CGM) | |
ImplicitParamDecl * | getThisDecl (CodeGenFunction &CGF) |
llvm::Value * | getThisValue (CodeGenFunction &CGF) |
Address | getThisAddress (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) |
llvm::Value * | loadIncomingCXXThis (CodeGenFunction &CGF) |
Loads the incoming C++ this pointer as it was passed by the caller. | |
void | setCXXABIThisValue (CodeGenFunction &CGF, llvm::Value *ThisPtr) |
ASTContext & | getContext () const |
bool | mayNeedDestruction (const VarDecl *VD) const |
bool | isEmittedWithConstantInitializer (const VarDecl *VD, bool InspectInitForWeakDef=false) const |
Determine whether we will definitely emit this variable with a constant initializer, either because the language semantics demand it or because we know that the initializer is a constant. | |
virtual bool | requiresArrayCookie (const CXXDeleteExpr *E, QualType eltType) |
virtual bool | requiresArrayCookie (const CXXNewExpr *E) |
virtual bool | isThisCompleteObject (GlobalDecl GD) const =0 |
Determine whether there's something special about the rules of the ABI tell us that 'this' is a complete object within the given function. | |
virtual bool | constructorsAndDestructorsReturnThis () const |
llvm::Constant * | getMemberPointerAdjustment (const CastExpr *E) |
A utility method for computing the offset required for the given base-to-derived or derived-to-base member-pointer conversion. | |
virtual CharUnits | getArrayCookieSizeImpl (QualType elementType) |
Returns the extra size required in order to store the array cookie for the given type. | |
virtual llvm::Value * | readArrayCookieImpl (CodeGenFunction &IGF, Address ptr, CharUnits cookieSize) |
Reads the array cookie for an allocation which is known to have one. | |
Protected Attributes | |
CodeGenModule & | CGM |
std::unique_ptr< MangleContext > | MangleCtx |
Friends | |
class | CodeGenModule |
Implements C++ ABI-specific code generation functions.
Definition at line 43 of file CGCXXABI.h.
using clang::CodeGen::CGCXXABI::DeleteOrMemberCallExpr = llvm::PointerUnion<const CXXDeleteExpr *, const CXXMemberCallExpr *> |
Definition at line 484 of file CGCXXABI.h.
Specify how one should pass an argument of a record type.
Definition at line 150 of file CGCXXABI.h.
|
inlineprotected |
Definition at line 50 of file CGCXXABI.h.
|
virtual |
Definition at line 21 of file CGCXXABI.cpp.
CGCXXABI::AddedStructorArgCounts CGCXXABI::addImplicitConstructorArgs | ( | CodeGenFunction & | CGF, |
const CXXConstructorDecl * | D, | ||
CXXCtorType | Type, | ||
bool | ForVirtualBase, | ||
bool | Delegating, | ||
CallArgList & | Args | ||
) |
Add any ABI-specific implicit arguments needed to call a constructor.
Definition at line 346 of file CGCXXABI.cpp.
References clang::CodeGen::CallArgList::add(), D, clang::Delegating, clang::CodeGen::RValue::get(), getImplicitConstructorArgs(), clang::CodeGen::CGCXXABI::AddedStructorArgs::Prefix, and clang::CodeGen::CGCXXABI::AddedStructorArgs::Suffix.
|
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.
|
inlinevirtual |
Definition at line 494 of file CGCXXABI.h.
|
inlinevirtual |
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 395 of file CGCXXABI.h.
|
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().
void CGCXXABI::buildThisParam | ( | CodeGenFunction & | CGF, |
FunctionArgList & | Params | ||
) |
Build a parameter variable suitable for 'this'.
Definition at line 128 of file CGCXXABI.cpp.
References CGM, clang::ImplicitParamDecl::Create(), clang::CodeGen::CodeGenFunction::CurGD, clang::CXXThis, clang::IdentifierTable::get(), clang::ASTContext::getASTRecordLayout(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getContext(), clang::GlobalDecl::getDecl(), clang::Decl::getLocation(), clang::CXXRecordDecl::getNumVBases(), clang::CXXMethodDecl::getParent(), clang::CXXMethodDecl::getThisType(), clang::ASTContext::Idents, clang::CXXRecordDecl::isEffectivelyFinal(), and isThisCompleteObject().
|
inlinevirtual |
Returns true if the target allows calling a function through a pointer with a different signature than the actual function (or equivalently, bitcasting a function or function pointer to a different function type).
In principle in the most general case this could depend on the target, the calling convention, and the actual types of the arguments and return value. Here it just means whether the signature mismatch could ever be allowed; in other words, does the target do strict checking of signatures for all calls.
Definition at line 143 of file CGCXXABI.h.
Referenced by EmitDeclDestroy().
|
pure virtual |
Determine whether it's possible to emit a vtable for RD
, even though we do not know that the vtable has been marked as used by semantic analysis.
Referenced by shouldEmitAvailableExternallyVTable().
|
pure virtual |
If the C++ ABI requires the given type be returned in a particular way, this method sets RetAI and returns true.
|
inlineprotectedvirtual |
Definition at line 104 of file CGCXXABI.h.
References CGM, and clang::CodeGen::CodeGenModule::getCodeGenOpts().
Referenced by HasThisReturn().
|
virtual |
Find the LLVM type used to represent the given member pointer type.
Definition at line 43 of file CGCXXABI.cpp.
References CGM, clang::CodeGen::CodeGenTypes::ConvertType(), clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getPointerDiffType(), and clang::CodeGen::CodeGenModule::getTypes().
Referenced by clang::CodeGen::CodeGenTypes::ConvertType().
|
pure virtual |
Checks if ABI requires to initialize vptrs for given dynamic class.
|
pure virtual |
Referenced by EmitDynamicCastToNull().
|
pure virtual |
Referenced by EmitTypeidFromVTable().
|
pure virtual |
|
virtual |
Definition at line 305 of file CGCXXABI.cpp.
References CGM, ErrorUnsupportedABI(), clang::TargetInfo::getCXXABI(), clang::CodeGen::CodeGenModule::getTarget(), and clang::TargetCXXABI::hasConstructorVariants().
|
pure virtual |
Emit constructor variants required by this ABI.
Referenced by clang::CodeGen::CodeGenModule::EmitTopLevelDecl().
|
pure virtual |
Emit destructor variants required by this ABI.
Referenced by clang::CodeGen::CodeGenModule::EmitTopLevelDecl().
|
pure virtual |
Emit a single constructor/destructor with the given type from a C++ constructor Decl.
|
pure virtual |
Emit the destructor call.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Emit a dynamic_cast from SrcRecordTy to DestRecordTy.
The cast fails if the dynamic type of Value is not exactly DestRecordTy.
|
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:
|
pure virtual |
Emit the ABI-specific prolog for the function.
|
virtual |
Load a member function from an object and a member function pointer.
Apply the this-adjustment and set 'This' to the adjusted value.
Definition at line 47 of file CGCXXABI.cpp.
References clang::Type::castAs(), CGM, ErrorUnsupportedABI(), clang::CodeGen::CGCallee::forDirect(), clang::Type::getAs(), clang::CodeGen::CodeGenFunction::getAsNaturalPointerTo(), clang::MemberPointerType::getClass(), clang::CodeGen::CodeGenFunction::getContext(), clang::RecordType::getDecl(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::MemberPointerType::getPointeeType(), and clang::ASTContext::getRecordType().
|
virtual |
Create a member pointer for the given field.
Definition at line 114 of file CGCXXABI.cpp.
References GetBogusMemberPointer().
Referenced by clang::CodeGen::CodeGenModule::getMemberPointerConstant().
|
virtual |
Calculate an l-value from an object and a data member pointer.
Definition at line 65 of file CGCXXABI.cpp.
References ErrorUnsupportedABI(), and clang::CodeGen::CodeGenFunction::getLLVMContext().
|
virtual |
Create a member pointer for the given method.
Definition at line 109 of file CGCXXABI.cpp.
References CGM, GetBogusMemberPointer(), clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getMemberPointerType(), clang::CXXMethodDecl::getParent(), clang::ValueDecl::getType(), and clang::TypeDecl::getTypeForDecl().
Referenced by clang::CodeGen::CodeGenModule::getMemberPointerConstant().
Create a member pointer for the given member pointer constant.
Definition at line 119 of file CGCXXABI.cpp.
References GetBogusMemberPointer().
Referenced by clang::CodeGen::ConstantEmitter::tryEmitPrivate().
|
virtual |
Emit a comparison between two member pointers. Returns an i1.
Definition at line 87 of file CGCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::Builder, and ErrorUnsupportedABI().
Referenced by EmitCompare().
|
virtual |
Perform a derived-to-base, base-to-derived, or bitcast member pointer conversion.
Definition at line 74 of file CGCXXABI.cpp.
References E, ErrorUnsupportedABI(), GetBogusMemberPointer(), and clang::Expr::getType().
|
virtual |
Perform a derived-to-base, base-to-derived, or bitcast member pointer conversion on a constant value.
Definition at line 81 of file CGCXXABI.cpp.
References E, GetBogusMemberPointer(), and clang::Expr::getType().
|
virtual |
Determine if a member pointer is non-null. Returns an i1.
Definition at line 97 of file CGCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::Builder, and ErrorUnsupportedABI().
|
virtual |
Create a null member pointer of the given type.
Definition at line 105 of file CGCXXABI.cpp.
References GetBogusMemberPointer().
Referenced by clang::CodeGen::CodeGenModule::EmitNullConstant().
|
pure virtual |
|
virtual |
Definition at line 208 of file CGCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::hasAggregateEvaluationKind().
|
virtual |
Definition at line 332 of file CGCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), and clang::CodeGen::CodeGenModule::getTerminateFn().
|
pure virtual |
Emits ABI-required functions necessary to initialize thread_local variables in this translation unit.
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. |
|
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().
|
pure virtual |
|
pure virtual |
Referenced by EmitTypeidFromVTable().
|
pure virtual |
Emit the ABI-specific virtual destructor call.
|
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().
|
pure virtual |
Referenced by EmitDestroyingObjectDelete(), and EmitObjectDelete().
|
pure virtual |
Emits the VTable definitions required for the given record type.
Referenced by clang::CodeGen::CodeGenVTables::GenerateClassData().
|
protected |
Issue a diagnostic about unsupported features in the ABI.
Definition at line 29 of file CGCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::CurCodeDecl, clang::DiagnosticsEngine::Error, clang::CodeGen::CodeGenFunction::getContext(), clang::DiagnosticsEngine::getCustomDiagID(), clang::CodeGen::CodeGenModule::getDiags(), clang::ASTContext::getFullLoc(), clang::Decl::getLocation(), and clang::DiagnosticsEngine::Report().
Referenced by EmitCtorCompleteObjectHandler(), EmitLoadOfMemberFunctionPointer(), EmitMemberDataPointerAddress(), EmitMemberPointerComparison(), EmitMemberPointerConversion(), EmitMemberPointerIsNotNull(), InitializeArrayCookie(), and readArrayCookieImpl().
|
pure virtual |
Referenced by setThunkProperties().
|
pure virtual |
|
pure virtual |
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfRTTIDescriptor().
|
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().
|
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:
expr | - the new-expression being allocated. |
Definition at line 215 of file CGCXXABI.cpp.
References clang::ast_matchers::expr, getArrayCookieSizeImpl(), requiresArrayCookie(), and clang::CharUnits::Zero().
Referenced by CalculateCookiePadding().
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 221 of file CGCXXABI.cpp.
References clang::CharUnits::Zero().
Referenced by GetArrayCookieSize(), and ReadArrayCookie().
|
protected |
Get a null value for unsupported member pointers.
Definition at line 38 of file CGCXXABI.cpp.
References CGM, clang::CodeGen::CodeGenTypes::ConvertType(), clang::CodeGen::CodeGenModule::getTypes(), and clang::T.
Referenced by EmitMemberDataPointer(), EmitMemberFunctionPointer(), EmitMemberPointer(), EmitMemberPointerConversion(), and EmitNullMemberPointer().
|
virtual |
Definition at line 338 of file CGCXXABI.cpp.
|
inlineprotected |
Definition at line 81 of file CGCXXABI.h.
References CGM, and clang::CodeGen::CodeGenModule::getContext().
Referenced by isEmittedWithConstantInitializer(), and mayNeedDestruction().
|
pure virtual |
Get the implicit (second) parameter that comes after the "this" pointer, or nullptr if there is isn't one.
Referenced by clang::CodeGen::getCXXDestructorImplicitParam().
|
virtual |
Definition at line 321 of file CGCXXABI.cpp.
References CGM, and clang::CodeGen::CodeGenModule::getLLVMLinkageForDeclarator().
Referenced by clang::CodeGen::CodeGenModule::getFunctionLinkage().
|
pure virtual |
Gets the deleted virtual member call name.
|
pure virtual |
Referenced by addImplicitConstructorArgs(), and clang::CodeGen::getImplicitCXXConstructorArgs().
|
inline |
Gets the mangle context.
Definition at line 113 of file CGCXXABI.h.
References MangleCtx.
Referenced by clang::CodeGen::CodeGenModule::CodeGenModule(), clang::CodeGen::CodeGenModule::CreateKCFITypeId(), clang::CodeGen::CGOpenMPRuntime::emitUserDefinedMapper(), clang::CodeGen::CodeGenModule::EmitVTableTypeMetadata(), clang::CodeGen::CodeGenVTables::GenerateConstructionVTable(), clang::CodeGen::CodeGenModule::GetAddrOfConstantStringFromLiteral(), clang::CodeGen::CodeGenModule::GetAddrOfGlobalTemporary(), clang::CodeGen::CodeGenVTables::GetAddrOfVTT(), getBlockCaptureStr(), clang::CodeGen::CodeGenModule::getBlockMangledName(), getMangledNameImpl(), clang::CodeGen::CGObjCRuntime::getSymbolNameForMethod(), and getTypeIdentifier().
|
protected |
A utility method for computing the offset required for the given base-to-derived or derived-to-base member-pointer conversion.
Returns the adjustment, in bytes, required for the given member-pointer operation.
Does not handle virtual conversions (in case we ever fully support an ABI that allows this). Returns null if no adjustment is required.
Returns null if no adjustment is required.
Definition at line 286 of file CGCXXABI.cpp.
References clang::Type::castAs(), CGM, E, clang::Type::getAsCXXRecordDecl(), clang::CodeGen::CodeGenModule::GetNonVirtualBaseClassOffset(), and clang::Expr::getType().
|
pure virtual |
Gets the pure virtual member call function.
|
pure virtual |
Returns how an argument of the given record type should be passed.
Referenced by isInAllocaArgument().
|
pure virtual |
Referenced by EmitMemberInitializer().
|
inlineprotected |
Definition at line 69 of file CGCXXABI.h.
|
inlineprotected |
Definition at line 72 of file CGCXXABI.h.
|
protected |
Definition at line 23 of file CGCXXABI.cpp.
References clang::Type::getPointeeType(), clang::ValueDecl::getType(), and clang::CodeGen::CodeGenFunction::makeNaturalAddressForPointer().
|
inlinevirtual |
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 387 of file CGCXXABI.h.
References clang::GlobalDecl::getDecl(), and clang::DeclContext::getParent().
Referenced by clang::CodeGen::CodeGenTypes::arrangeCXXMethodDeclaration(), clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration(), and commonEmitCXXMemberOrOperatorCall().
|
inlineprotected |
Definition at line 54 of file CGCXXABI.h.
Referenced by loadIncomingCXXThis(), and setCXXABIThisValue().
|
inlineprotected |
Definition at line 57 of file CGCXXABI.h.
|
inlinevirtual |
Definition at line 259 of file CGCXXABI.h.
|
virtual |
Gets the offsets of all the virtual base pointers in a given class.
Definition at line 342 of file CGCXXABI.cpp.
Referenced by EmitNullBaseClassInitialization().
|
pure virtual |
|
pure virtual |
Build a virtual function pointer in the ABI-specific way.
Referenced by clang::CodeGen::CGCallee::prepareConcreteCallee().
|
inlinevirtual |
Get the ABI-specific "this" parameter adjustment to apply in the prologue of a virtual function.
Definition at line 415 of file CGCXXABI.h.
References clang::CharUnits::Zero().
|
pure virtual |
Get the address point of the vtable for the given base subobject.
|
pure virtual |
Get the address point of the vtable for the given base subobject while building a constructor or a destructor.
|
inlinevirtual |
Definition at line 131 of file CGCXXABI.h.
Referenced by clang::CodeGen::CodeGenTypes::arrangeCXXConstructorCall(), and clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration().
|
inlinevirtual |
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 123 of file CGCXXABI.h.
References constructorsAndDestructorsReturnThis(), clang::Dtor_Deleting, clang::GlobalDecl::getDecl(), and clang::GlobalDecl::getDtorType().
Referenced by clang::CodeGen::CodeGenTypes::arrangeCXXConstructorCall(), clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration(), and EmitDeclDestroy().
|
virtual |
Initialize the array cookie for the given allocation.
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 226 of file CGCXXABI.cpp.
References ErrorUnsupportedABI(), and clang::CodeGen::Address::invalid().
|
inlinevirtual |
Emit the code to initialize hidden members required to handle virtual inheritance, if needed by the ABI.
Definition at line 319 of file CGCXXABI.h.
|
protected |
Determine whether we will definitely emit this variable with a constant initializer, either because the language semantics demand it or because we know that the initializer is a constant.
Definition at line 176 of file CGCXXABI.cpp.
References clang::VarDecl::evaluateValue(), getContext(), clang::VarDecl::getInitializingDeclaration(), clang::Redeclarable< decl_type >::getMostRecentDecl(), clang::Decl::hasAttr(), clang::VarDecl::hasConstantInitialization(), clang::VarDecl::hasInit(), clang::isUniqueGVALinkage(), clang::ValueDecl::isWeak(), and mayNeedDestruction().
|
inlinevirtual |
Return whether or not a member pointers type is convertible to an IR type.
Definition at line 213 of file CGCXXABI.h.
Referenced by clang::CodeGen::CodeGenTypes::isFuncParamTypeConvertible().
|
inlinevirtual |
Returns true if the ABI permits the argument to be a homogeneous aggregate.
Definition at line 174 of file CGCXXABI.h.
|
inlinevirtual |
Returns true if the implicit 'sret' parameter comes after the implicit 'this' parameter of C++ instance methods.
Definition at line 169 of file CGCXXABI.h.
|
protectedpure virtual |
Determine whether there's something special about the rules of the ABI tell us that 'this' is a complete object within the given function.
Obvious common logic like being defined on a final class will have been taken care of by the caller.
Referenced by buildThisParam().
|
pure virtual |
Checks if ABI requires extra virtual offset for vtable field.
|
virtual |
Return true if the given member pointer can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer.
Definition at line 123 of file CGCXXABI.cpp.
Referenced by clang::CodeGen::CodeGenTypes::isZeroInitializable().
|
protected |
Loads the incoming C++ this pointer as it was passed by the caller.
Definition at line 152 of file CGCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), and getThisDecl().
|
pure virtual |
Load a vtable from This, an object of polymorphic type RD, or from one of its virtual bases if it does not have its own vtable.
Returns the vtable and the class from which the vtable was loaded.
Definition at line 163 of file CGCXXABI.cpp.
References clang::Type::getAs(), clang::Type::getBaseElementTypeUnsafe(), getContext(), clang::ValueDecl::getType(), clang::Type::isIncompleteType(), clang::VarDecl::needsDestruction(), and clang::T.
Referenced by isEmittedWithConstantInitializer().
|
virtual |
Return whether the given global decl needs a VTT parameter.
Definition at line 327 of file CGCXXABI.cpp.
|
pure virtual |
Referenced by PerformReturnAdjustment().
|
pure virtual |
|
virtual |
Reads the array cookie associated with the given pointer, if it has one.
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 255 of file CGCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::Address::emitRawPointer(), clang::ast_matchers::expr, getArrayCookieSizeImpl(), clang::CodeGen::CodeGenTypeCache::Int8Ty, readArrayCookieImpl(), requiresArrayCookie(), clang::CodeGen::Address::withElementType(), and clang::CharUnits::Zero().
Referenced by EmitArrayDelete().
|
protectedvirtual |
Reads the array cookie for an allocation which is known to have one.
This is called by the standard implementation of ReadArrayCookie.
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.
Definition at line 276 of file CGCXXABI.cpp.
References ErrorUnsupportedABI(), and clang::CodeGen::CodeGenTypeCache::SizeTy.
Referenced by ReadArrayCookie().
|
pure virtual |
Emit code to force the execution of a destructor during global teardown.
The default implementation of this uses atexit.
Dtor | - a function taking a single pointer argument |
Addr | - a pointer to pass to the destructor function. |
Referenced by EmitDeclDestroy(), and pushTemporaryCleanup().
|
protectedvirtual |
Definition at line 236 of file CGCXXABI.cpp.
References clang::ast_matchers::expr, and clang::QualType::isDestructedType().
Referenced by GetArrayCookieSize(), and ReadArrayCookie().
|
protectedvirtual |
Definition at line 246 of file CGCXXABI.cpp.
References clang::ast_matchers::expr.
|
protected |
|
virtual |
Definition at line 314 of file CGCXXABI.cpp.
References CGM, and clang::CodeGen::CodeGenModule::setDLLImportDLLExport().
Referenced by clang::CodeGen::CodeGenModule::setDLLImportDLLExport().
|
pure virtual |
Referenced by setThunkProperties().
|
pure virtual |
|
pure virtual |
|
pure virtual |
Referenced by EmitTypeidFromVTable().
|
inlinevirtual |
Definition at line 133 of file CGCXXABI.h.
|
pure virtual |
Referenced by EmitGlobalVarDeclLValue().
|
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.
|
friend |
Definition at line 44 of file CGCXXABI.h.
|
protected |
Definition at line 47 of file CGCXXABI.h.
Referenced by buildThisParam(), constructorsAndDestructorsReturnThis(), ConvertMemberPointerType(), EmitCtorCompleteObjectHandler(), EmitLoadOfMemberFunctionPointer(), EmitMemberFunctionPointer(), GetBogusMemberPointer(), getContext(), getCXXDestructorLinkage(), getMemberPointerAdjustment(), and setCXXDestructorDLLStorage().
|
protected |
Definition at line 48 of file CGCXXABI.h.
Referenced by getMangleContext().