17 using namespace clang;
18 using namespace CodeGen;
25 "cannot yet compile %0 in this ABI");
45 bool CopyDeleted =
false;
46 bool MoveDeleted =
false;
48 if (CD->isCopyConstructor() || CD->isMoveConstructor()) {
49 assert(CD->isTrivial());
54 if (CD->isCopyConstructor())
63 return !(CopyDeleted && MoveDeleted);
86 return llvm::Constant::getNullValue(FTy->getPointerTo());
95 return llvm::Constant::getNullValue(Ty);
106 llvm::Constant *Src) {
161 params.push_back(ThisDecl);
167 assert(
getThisDecl(CGF) &&
"no 'this' variable for function");
175 CGF.EmitReturnOfRValue(RV, ResultType);
223 unsigned AS = ptr->getType()->getPointerAddressSpace();
224 llvm::Type *charPtrTy = CGF.
Int8Ty->getPointerTo(AS);
225 ptr = CGF.
Builder.CreateBitCast(ptr, charPtrTy);
230 numElements =
nullptr;
236 allocPtr = CGF.
Builder.CreateConstInBoundsGEP1_64(ptr,
245 return llvm::ConstantInt::get(CGF.
SizeTy, 0);
277 for (
unsigned I = 0, N = Path.size(); I != N; ++I) {
281 std::swap(Base, Derived);
287 ThisAdjustment = -ThisAdjustment;
288 return ThisAdjustment;
295 llvm_unreachable(
"shouldn't be called in this ABI");
CastKind getCastKind() const
virtual llvm::Constant * EmitMemberPointer(const APValue &MP, QualType MPT)
Create a member pointer for the given member pointer constant.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
CodeGenTypes & getTypes()
virtual llvm::Value * readArrayCookieImpl(CodeGenFunction &IGF, llvm::Value *ptr, CharUnits cookieSize)
DestructionKind isDestructedType() const
virtual void EmitReturnFromThunk(CodeGenFunction &CGF, RValue RV, QualType ResultType)
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
bool hasNonTrivialDestructor() const
Determine whether this class has a non-trivial destructor (C++ [class.dtor]p3)
FullSourceLoc getFullLoc(SourceLocation Loc) const
QualType getPointeeType() const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
ImplicitParamDecl *& getThisDecl(CodeGenFunction &CGF)
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Represents a C++ constructor within a class.
bool doesUsualArrayDeleteWantSize() const
virtual llvm::BasicBlock * EmitCtorCompleteObjectHandler(CodeGenFunction &CGF, const CXXRecordDecl *RD)
A this pointer adjustment.
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
void EmitThisParam(CodeGenFunction &CGF)
virtual bool requiresArrayCookie(const CXXDeleteExpr *E, QualType eltType)
ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6, C++11 [class.copy]p12)
llvm::IntegerType * SizeTy
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
const Decl * getDecl() const
const ValueDecl * getMemberPointerDecl() const
const CXXRecordDecl * getParent() const
path_iterator path_begin()
Concrete class used by the front-end to report problems and issues.
virtual llvm::Value * EmitMemberPointerIsNotNull(CodeGenFunction &CGF, llvm::Value *MemPtr, const MemberPointerType *MPT)
Determine if a member pointer is non-null. Returns an i1.
llvm::Constant * getTerminateFn()
Get the declaration of std::terminate for the platform.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
virtual llvm::Type * ConvertMemberPointerType(const MemberPointerType *MPT)
virtual bool isZeroInitializable(const MemberPointerType *MPT)
llvm::CallInst * EmitNounwindRuntimeCall(llvm::Value *callee, const Twine &name="")
virtual CharUnits GetArrayCookieSize(const CXXNewExpr *expr)
const TargetInfo & getTarget() const
bool hasConstructorVariants() const
Does this ABI have different entrypoints for complete-object and base-subobject constructors?
virtual void ReadArrayCookie(CodeGenFunction &CGF, llvm::Value *Ptr, const CXXDeleteExpr *expr, QualType ElementType, llvm::Value *&NumElements, llvm::Value *&AllocPtr, CharUnits &CookieSize)
const Type * getTypeForDecl() const
virtual CharUnits getArrayCookieSizeImpl(QualType elementType)
llvm::Value * GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
bool isMemberPointerToDerivedMember() const
DeclContext * getDeclContext()
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
ASTContext & getContext() const
QualType getAllocatedType() const
virtual llvm::Constant * EmitMemberFunctionPointer(const CXXMethodDecl *MD)
Create a member pointer for the given method.
void ErrorUnsupportedABI(CodeGenFunction &CGF, StringRef S)
Issue a diagnostic about unsupported features in the ABI.
virtual llvm::Value * EmitMemberPointerConversion(CodeGenFunction &CGF, const CastExpr *E, llvm::Value *Src)
virtual bool NeedsVTTParameter(GlobalDecl GD)
Return whether the given global decl needs a VTT parameter.
ASTContext & getContext() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
bool canCopyArgument(const CXXRecordDecl *RD) const
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Represents a static or instance method of a struct/union/class.
virtual llvm::Value * EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF, const Expr *E, llvm::Value *&This, llvm::Value *MemPtr, const MemberPointerType *MPT)
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
virtual llvm::Constant * EmitNullMemberPointer(const MemberPointerType *MPT)
Create a null member pointer of the given type.
const CGFunctionInfo & arrangeCXXMethodType(const CXXRecordDecl *RD, const FunctionProtoType *FTP)
llvm::Constant * getMemberPointerAdjustment(const CastExpr *E)
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.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
Represents a delete expression for memory deallocation and destructor calls, e.g. "delete[] pArray"...
void buildThisParam(CodeGenFunction &CGF, FunctionArgList &Params)
Build a parameter variable suitable for 'this'.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>. Pointer - pointer requires t...
virtual llvm::Value * EmitMemberDataPointerAddress(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.
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T)
ASTContext & getContext() const
virtual llvm::Constant * EmitMemberDataPointer(const MemberPointerType *MPT, CharUnits offset)
Create a member pointer for the given field.
llvm::Constant * GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd)
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
const Type * getClass() const
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12) ...
DiagnosticsEngine & getDiags() const
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
llvm::Type * ConvertType(QualType T)
bool doesUsualArrayDeleteWantSize() const
virtual llvm::CallInst * emitTerminateForUnexpectedException(CodeGenFunction &CGF, llvm::Value *Exn)
SourceLocation getLocation() const
virtual llvm::Value * InitializeArrayCookie(CodeGenFunction &CGF, llvm::Value *NewPtr, llvm::Value *NumElements, const CXXNewExpr *expr, QualType ElementType)
llvm::Value *& getThisValue(CodeGenFunction &CGF)
llvm::Constant * GetBogusMemberPointer(QualType T)
Get a null value for unsupported member pointers.
CharUnits getMemberPointerPathAdjustment(const APValue &MP)
Computes the non-virtual adjustment needed for a member pointer conversion along an inheritance path ...
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.