14 #ifndef LLVM_CLANG_LIB_CODEGEN_CGCXXABI_H 15 #define LLVM_CLANG_LIB_CODEGEN_CGCXXABI_H 29 class CXXConstructorDecl;
30 class CXXDestructorDecl;
38 class CodeGenFunction;
49 : CGM(CGM), MangleCtx(CGM.getContext().createMangleContext()) {}
53 return CGF.CXXABIThisDecl;
56 return CGF.CXXABIThisValue;
59 return Address(CGF.CXXABIThisValue, CGF.CXXABIThisAlignment);
66 llvm::Constant *GetBogusMemberPointer(
QualType T);
69 return CGF.CXXStructorImplicitParamDecl;
72 return CGF.CXXStructorImplicitParamValue;
83 virtual bool requiresArrayCookie(
const CXXNewExpr *E);
89 virtual bool isThisCompleteObject(
GlobalDecl GD)
const = 0;
154 virtual CGCallee EmitLoadOfMemberFunctionPointer(
173 virtual llvm::Constant *EmitMemberPointerConversion(
const CastExpr *E,
174 llvm::Constant *Src);
189 virtual llvm::Constant *EmitMemberFunctionPointer(
const CXXMethodDecl *MD);
196 virtual llvm::Constant *EmitMemberPointer(
const APValue &MP,
QualType MPT);
218 llvm::Constant *getMemberPointerAdjustment(
const CastExpr *E);
238 virtual bool canSpeculativelyEmitVTable(
const CXXRecordDecl *RD)
const = 0;
242 virtual llvm::CallInst *
246 virtual llvm::Constant *getAddrOfRTTIDescriptor(
QualType Ty) = 0;
251 virtual bool shouldTypeidBeNullChecked(
bool IsDeref,
256 llvm::Type *StdTypeInfoPtrTy) = 0;
258 virtual bool shouldDynamicCastCallBeNullChecked(
bool SrcIsPtr,
264 QualType DestRecordTy, llvm::BasicBlock *CastEnd) = 0;
278 virtual llvm::BasicBlock *EmitCtorCompleteObjectHandler(
CodeGenFunction &CGF,
317 virtual void setCXXDestructorDLLStorage(llvm::GlobalValue *GV,
321 virtual llvm::GlobalValue::LinkageTypes
342 Address This,
bool VirtualCall) {
380 bool ForVirtualBase,
bool Delegating,
393 virtual bool doStructorsInitializeVPtrs(
const CXXRecordDecl *VTableClass) = 0;
396 virtual llvm::Constant *
409 virtual llvm::Constant *
415 virtual llvm::GlobalVariable *getAddrOfVTable(
const CXXRecordDecl *RD,
425 llvm::PointerUnion<const CXXDeleteExpr *, const CXXMemberCallExpr *>;
441 virtual void emitVirtualInheritanceTables(
const CXXRecordDecl *RD) = 0;
443 virtual bool exportThunk() = 0;
444 virtual void setThunkLinkage(llvm::Function *Thunk,
bool ForVTable,
453 const ReturnAdjustment &RA) = 0;
462 virtual std::vector<CharUnits> getVBPtrOffsets(
const CXXRecordDecl *RD);
465 virtual StringRef GetPureVirtualCallName() = 0;
468 virtual StringRef GetDeletedVirtualCallName() = 0;
517 virtual bool NeedsVTTParameter(
GlobalDecl GD);
550 llvm::GlobalVariable *DeclPtr,
551 bool PerformInit) = 0;
559 llvm::FunctionCallee Dtor,
560 llvm::Constant *Addr) = 0;
573 virtual void EmitThreadLocalInitFuncs(
580 virtual bool usesThreadWrapperFunction(
const VarDecl *VD)
const = 0;
591 virtual void emitCXXStructor(
GlobalDecl GD) = 0;
596 virtual std::pair<llvm::Value *, const CXXRecordDecl *>
616 CGF.
Builder.CreateCatchRet(CPI, BB);
A (possibly-)qualified type.
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
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...
The base class of the type hierarchy.
Represents a C++ constructor within a class.
llvm::Value *& getStructorImplicitParamValue(CodeGenFunction &CGF)
Represents a variable declaration or definition.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
bool This(InterpState &S, CodePtr OpPC)
A this pointer adjustment.
A C++ throw-expression (C++ [except.throw]).
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool Zero(InterpState &S, CodePtr OpPC)
CharUnits - This is an opaque type for sizes expressed in character units.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
virtual bool hasMostDerivedReturn(GlobalDecl GD) const
ImplicitParamDecl * getThisDecl(CodeGenFunction &CGF)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
virtual bool canCallMismatchedFunctionType() const
Returns true if the target allows calling a function through a pointer with a different signature tha...
llvm::PointerUnion< const CXXDeleteExpr *, const CXXMemberCallExpr * > DeleteOrMemberCallExpr
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
ImplicitParamDecl *& getStructorImplicitParamDecl(CodeGenFunction &CGF)
virtual bool HasThisReturn(GlobalDecl GD) const
Returns true if the given constructor or destructor is one of the kinds that the ABI says returns 'th...
CXXDtorType
C++ destructor types.
This represents one expression.
Represents a C++ destructor within a class.
virtual CharUnits getVirtualFunctionPrologueThisAdjustment(GlobalDecl GD)
Get the ABI-specific "this" parameter adjustment to apply in the prologue of a virtual function...
CGCXXABI(CodeGenModule &CGM)
static bool classifyReturnType(const CGCXXABI &CXXABI, CGFunctionInfo &FI, const ABIInfo &Info)
ASTContext & getContext() const
ASTContext & getContext() const
virtual void adjustCallArgsForDestructorThunk(CodeGenFunction &CGF, GlobalDecl GD, CallArgList &CallArgs)
GlobalDecl - represents a global declaration.
CatchRetScope(llvm::CatchPadInst *CPI)
Encodes a location in the source.
static bool Ret(InterpState &S, CodePtr &PC, APValue &Result)
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
static AddedStructorArgs suffix(unsigned N)
Represents a static or instance method of a struct/union/class.
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
All available information about a concrete callee.
MangleContext & getMangleContext()
Gets the mangle context.
CGCXXABI * CreateMicrosoftCXXABI(CodeGenModule &CGM)
Creates a Microsoft-family ABI.
The MS C++ ABI needs a pointer to RTTI data plus some flags to describe the type of a catch handler...
CXXCtorType
C++ constructor types.
FunctionArgList - Type for representing both the decl and type of parameters to a function...
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
Optional< types::ID > Type
Dataflow Directional Tag Classes.
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
virtual bool isSRetParameterAfterThis() const
Returns true if the implicit 'sret' parameter comes after the implicit 'this' parameter of C++ instan...
static AddedStructorArgs prefix(unsigned N)
virtual bool isMemberPointerConvertible(const MemberPointerType *MPT) const
Return whether or not a member pointers type is convertible to an IR type.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined...
A pointer to member type per C++ 8.3.3 - Pointers to members.
std::unique_ptr< MangleContext > MangleCtx
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.
Address getThisAddress(CodeGenFunction &CGF)
Implements C++ ABI-specific code generation functions.
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
Pass it on the stack using its defined layout.
static CGCXXABI::RecordArgABI getRecordArgABI(const RecordType *RT, CGCXXABI &CXXABI)
Represents a C++ struct/union/class.
CGCXXABI * CreateItaniumCXXABI(CodeGenModule &CGM)
Creates an Itanium-family ABI.
virtual const CXXRecordDecl * getThisArgumentTypeForMethod(const CXXMethodDecl *MD)
Get the type of the implicit "this" parameter used by a method.
void Emit(CodeGenFunction &CGF, Flags flags) override
Emit the cleanup.
CXXCatchStmt - This represents a C++ catch block.
Struct with all information about dynamic [sub]class needed to set vptr.
GVALinkage
A more specific kind of linkage than enum Linkage.
virtual llvm::GlobalVariable * getThrowInfo(QualType T)
LValue - This represents an lvalue references.
Information for lazily generating a cleanup.
Notes how many arguments were added to the beginning (Prefix) and ending (Suffix) of an arg list...
RecordArgABI
Specify how one should pass an argument of a record type.
CallArgList - Type for representing both the value and type of arguments in a call.
llvm::Value * getThisValue(CodeGenFunction &CGF)
AddedStructorArgs(unsigned P, unsigned S)