15 #ifndef LLVM_CLANG_LIB_CODEGEN_CGCXXABI_H 16 #define LLVM_CLANG_LIB_CODEGEN_CGCXXABI_H 30 class CXXConstructorDecl;
31 class CXXDestructorDecl;
39 class CodeGenFunction;
50 : CGM(CGM), MangleCtx(CGM.getContext().createMangleContext()) {}
54 return CGF.CXXABIThisDecl;
57 return CGF.CXXABIThisValue;
60 return Address(CGF.CXXABIThisValue, CGF.CXXABIThisAlignment);
67 llvm::Constant *GetBogusMemberPointer(
QualType T);
70 return CGF.CXXStructorImplicitParamDecl;
73 return CGF.CXXStructorImplicitParamValue;
84 virtual bool requiresArrayCookie(
const CXXNewExpr *E);
90 virtual bool isThisCompleteObject(
GlobalDecl GD)
const = 0;
159 virtual CGCallee EmitLoadOfMemberFunctionPointer(
178 virtual llvm::Constant *EmitMemberPointerConversion(
const CastExpr *E,
179 llvm::Constant *Src);
194 virtual llvm::Constant *EmitMemberFunctionPointer(
const CXXMethodDecl *MD);
201 virtual llvm::Constant *EmitMemberPointer(
const APValue &MP,
QualType MPT);
223 llvm::Constant *getMemberPointerAdjustment(
const CastExpr *E);
243 virtual bool canSpeculativelyEmitVTable(
const CXXRecordDecl *RD)
const = 0;
247 virtual llvm::CallInst *
251 virtual llvm::Constant *getAddrOfRTTIDescriptor(
QualType Ty) = 0;
256 virtual bool shouldTypeidBeNullChecked(
bool IsDeref,
261 llvm::Type *StdTypeInfoPtrTy) = 0;
263 virtual bool shouldDynamicCastCallBeNullChecked(
bool SrcIsPtr,
269 QualType DestRecordTy, llvm::BasicBlock *CastEnd) = 0;
283 virtual llvm::BasicBlock *EmitCtorCompleteObjectHandler(
CodeGenFunction &CGF,
322 virtual void setCXXDestructorDLLStorage(llvm::GlobalValue *GV,
326 virtual llvm::GlobalValue::LinkageTypes
347 Address This,
bool VirtualCall) {
367 return CharUnits::Zero();
385 bool ForVirtualBase,
bool Delegating,
398 virtual bool doStructorsInitializeVPtrs(
const CXXRecordDecl *VTableClass) = 0;
401 virtual llvm::Constant *
414 virtual llvm::Constant *
420 virtual llvm::GlobalVariable *getAddrOfVTable(
const CXXRecordDecl *RD,
442 virtual void emitVirtualInheritanceTables(
const CXXRecordDecl *RD) = 0;
444 virtual bool exportThunk() = 0;
445 virtual void setThunkLinkage(llvm::Function *Thunk,
bool ForVTable,
454 const ReturnAdjustment &RA) = 0;
463 virtual std::vector<CharUnits> getVBPtrOffsets(
const CXXRecordDecl *RD);
466 virtual StringRef GetPureVirtualCallName() = 0;
469 virtual StringRef GetDeletedVirtualCallName() = 0;
518 virtual bool NeedsVTTParameter(
GlobalDecl GD);
551 llvm::GlobalVariable *DeclPtr,
552 bool PerformInit) = 0;
560 llvm::Constant *Dtor,
561 llvm::Constant *Addr) = 0;
574 virtual void EmitThreadLocalInitFuncs(
581 virtual bool usesThreadWrapperFunction()
const = 0;
597 virtual std::pair<llvm::Value *, const CXXRecordDecl *>
617 CGF.
Builder.CreateCatchRet(CPI, BB);
A (possibly-)qualified type.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
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.
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 ...
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...
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.
Expr - 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.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Represents a call to a member function that may be written either with member call syntax (e...
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.
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
Returns 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)