21 #include "llvm/IR/CallSite.h"
22 #include "llvm/IR/Intrinsics.h"
24 using namespace clang;
25 using namespace CodeGen;
31 assert(CE ==
nullptr || isa<CXXMemberCallExpr>(CE) ||
32 isa<CXXOperatorCallExpr>(CE));
34 "Trying to emit a member or operator call expr on a static method!");
61 unsigned ArgsToSkip = isa<CXXOperatorCallExpr>(CE) ? 1 : 0;
67 "No CallExpr specified for function with non-zero number of arguments");
79 *
this, MD, Callee, ReturnValue, This, ImplicitParam, ImplicitParamTy, CE,
91 ImplicitParam, ImplicitParamTy, CE, Args);
101 return cast<CXXRecordDecl>(Ty->
getDecl());
110 if (isa<BinaryOperator>(callee))
113 const MemberExpr *ME = cast<MemberExpr>(callee);
116 if (MD->isStatic()) {
129 CE, MD, ReturnValue, HasQualifier, Qualifier, IsArrow, Base);
136 assert(isa<CXXMemberCallExpr>(CE) || isa<CXXOperatorCallExpr>(CE));
139 bool CanUseVirtualCall = MD->
isVirtual() && !HasQualifier;
145 assert(DevirtualizedMethod);
155 DevirtualizedMethod =
nullptr;
165 DevirtualizedMethod =
nullptr;
177 if (isa<CXXDestructorDecl>(MD))
return RValue::get(
nullptr);
178 if (isa<CXXConstructorDecl>(MD) &&
179 cast<CXXConstructorDecl>(MD)->isDefaultConstructor())
187 unsigned ArgsToSkip = isa<CXXOperatorCallExpr>(CE) ? 1 : 0;
193 if (isa<CXXConstructorDecl>(MD) &&
194 cast<CXXConstructorDecl>(MD)->isCopyOrMoveConstructor()) {
196 assert(CE->
getNumArgs() == 1 &&
"unexpected argcount for trivial ctor");
201 llvm_unreachable(
"unknown trivial member function");
207 DevirtualizedMethod ? DevirtualizedMethod : MD;
209 if (
const auto *Dtor = dyn_cast<CXXDestructorDecl>(CalleeDecl))
212 else if (
const auto *Ctor = dyn_cast<CXXConstructorDecl>(CalleeDecl))
226 bool UseVirtualCall = CanUseVirtualCall && !DevirtualizedMethod;
231 "Destructor shouldn't have explicit parameters");
232 assert(ReturnValue.
isNull() &&
"Destructor shouldn't have return value");
233 if (UseVirtualCall) {
235 *
this, Dtor,
Dtor_Complete, This, cast<CXXMemberCallExpr>(CE));
239 else if (!DevirtualizedMethod)
244 cast<CXXDestructorDecl>(DevirtualizedMethod);
255 }
else if (UseVirtualCall) {
267 else if (!DevirtualizedMethod)
276 *
this, MD, This, UseVirtualCall);
316 ThisPtrForCall, MemFnPtr, MPT);
339 "Trying to emit a member call expr on a static method!");
341 E, MD, ReturnValue,
false,
nullptr,
369 std::vector<CharUnits> VBPtrOffsets =
371 for (
CharUnits VBPtrOffset : VBPtrOffsets) {
372 std::pair<CharUnits, CharUnits> LastStore = Stores.pop_back_val();
373 CharUnits LastStoreOffset = LastStore.first;
374 CharUnits LastStoreSize = LastStore.second;
376 CharUnits SplitBeforeOffset = LastStoreOffset;
377 CharUnits SplitBeforeSize = VBPtrOffset - SplitBeforeOffset;
378 assert(!SplitBeforeSize.
isNegative() &&
"negative store size!");
379 if (!SplitBeforeSize.
isZero())
380 Stores.emplace_back(SplitBeforeOffset, SplitBeforeSize);
382 CharUnits SplitAfterOffset = VBPtrOffset + VBPtrWidth;
383 CharUnits SplitAfterSize = LastStoreSize - SplitAfterOffset;
384 assert(!SplitAfterSize.
isNegative() &&
"negative store size!");
385 if (!SplitAfterSize.
isZero())
386 Stores.emplace_back(SplitAfterOffset, SplitAfterSize);
396 if (!NullConstantForBase->isNullValue()) {
397 llvm::GlobalVariable *NullVariable =
new llvm::GlobalVariable(
399 true, llvm::GlobalVariable::PrivateLinkage,
400 NullConstantForBase, Twine());
404 NullVariable->setAlignment(Align.getQuantity());
409 for (std::pair<CharUnits, CharUnits>
Store : Stores) {
423 for (std::pair<CharUnits, CharUnits>
Store : Stores) {
429 CGF.
Builder.getInt8(0), StoreSizeVal);
437 assert(!Dest.
isIgnored() &&
"Must have a destination!");
459 if (CD->isTrivial() && CD->isDefaultConstructor())
479 bool ForVirtualBase =
false;
480 bool Delegating =
false;
494 ForVirtualBase =
true;
510 Exp =
E->getSubExpr();
511 assert(isa<CXXConstructExpr>(Exp) &&
512 "EmitSynthesizedCXXCopyCtor - unknown copy ctor expr");
525 &&
"EmitSynthesizedCXXCopyCtor - Copied-in Array");
544 unsigned minElements,
553 return sizeWithoutCookie;
557 unsigned sizeWidth = CGF.
SizeTy->getBitWidth();
560 llvm::APInt cookieSize(sizeWidth,
567 assert(isa<llvm::IntegerType>(numElements->getType()));
577 llvm::IntegerType *numElementsType
578 = cast<llvm::IntegerType>(numElements->getType());
579 unsigned numElementsWidth = numElementsType->getBitWidth();
582 llvm::APInt arraySizeMultiplier(sizeWidth, 1);
585 type = CAT->getElementType();
586 arraySizeMultiplier *= CAT->getSize();
590 llvm::APInt typeSizeMultiplier(sizeWidth, typeSize.
getQuantity());
591 typeSizeMultiplier *= arraySizeMultiplier;
598 if (llvm::ConstantInt *numElementsC =
599 dyn_cast<llvm::ConstantInt>(numElements)) {
600 const llvm::APInt &count = numElementsC->getValue();
602 bool hasAnyOverflow =
false;
605 if (isSigned && count.isNegative())
606 hasAnyOverflow =
true;
611 else if (numElementsWidth > sizeWidth &&
612 numElementsWidth - sizeWidth > count.countLeadingZeros())
613 hasAnyOverflow =
true;
616 llvm::APInt adjustedCount = count.zextOrTrunc(sizeWidth);
620 if (adjustedCount.ult(minElements))
621 hasAnyOverflow =
true;
626 numElements = llvm::ConstantInt::get(CGF.
SizeTy,
627 adjustedCount * arraySizeMultiplier);
631 llvm::APInt allocationSize
632 = adjustedCount.umul_ov(typeSizeMultiplier, overflow);
633 hasAnyOverflow |= overflow;
636 if (cookieSize != 0) {
639 sizeWithoutCookie = llvm::ConstantInt::get(CGF.
SizeTy, allocationSize);
641 allocationSize = allocationSize.uadd_ov(cookieSize, overflow);
642 hasAnyOverflow |= overflow;
646 if (hasAnyOverflow) {
647 size = llvm::Constant::getAllOnesValue(CGF.
SizeTy);
649 size = llvm::ConstantInt::get(CGF.
SizeTy, allocationSize);
672 if (numElementsWidth > sizeWidth) {
673 llvm::APInt threshold(numElementsWidth, 1);
674 threshold <<= sizeWidth;
677 = llvm::ConstantInt::get(numElementsType, threshold);
679 hasOverflow = CGF.
Builder.CreateICmpUGE(numElements, thresholdV);
680 numElements = CGF.
Builder.CreateTrunc(numElements, CGF.
SizeTy);
683 }
else if (isSigned) {
684 if (numElementsWidth < sizeWidth)
685 numElements = CGF.
Builder.CreateSExt(numElements, CGF.
SizeTy);
692 if (typeSizeMultiplier == 1)
693 hasOverflow = CGF.
Builder.CreateICmpSLT(numElements,
694 llvm::ConstantInt::get(CGF.
SizeTy, minElements));
697 }
else if (numElementsWidth < sizeWidth) {
698 numElements = CGF.
Builder.CreateZExt(numElements, CGF.
SizeTy);
701 assert(numElements->getType() == CGF.
SizeTy);
706 hasOverflow = CGF.
Builder.CreateICmpULT(numElements,
707 llvm::ConstantInt::get(CGF.
SizeTy, minElements));
708 }
else if (numElementsWidth > sizeWidth) {
712 hasOverflow = CGF.
Builder.CreateOr(hasOverflow,
713 CGF.
Builder.CreateICmpULT(numElements,
714 llvm::ConstantInt::get(CGF.
SizeTy, minElements)));
727 if (typeSizeMultiplier != 1) {
732 llvm::ConstantInt::get(CGF.
SizeTy, typeSizeMultiplier);
734 CGF.
Builder.CreateCall(umul_with_overflow, {size, tsmV});
738 hasOverflow = CGF.
Builder.CreateOr(hasOverflow, overflowed);
740 hasOverflow = overflowed;
742 size = CGF.
Builder.CreateExtractValue(result, 0);
745 if (arraySizeMultiplier != 1) {
748 if (typeSize.
isOne()) {
749 assert(arraySizeMultiplier == typeSizeMultiplier);
755 llvm::ConstantInt::get(CGF.
SizeTy, arraySizeMultiplier);
756 numElements = CGF.
Builder.CreateMul(numElements, asmV);
761 assert(arraySizeMultiplier == 1);
765 if (cookieSize != 0) {
766 sizeWithoutCookie = size;
773 CGF.
Builder.CreateCall(uadd_with_overflow, {size, cookieSizeV});
777 hasOverflow = CGF.
Builder.CreateOr(hasOverflow, overflowed);
779 hasOverflow = overflowed;
781 size = CGF.
Builder.CreateExtractValue(result, 0);
788 size = CGF.
Builder.CreateSelect(hasOverflow,
789 llvm::Constant::getAllOnesValue(CGF.
SizeTy),
794 sizeWithoutCookie = size;
796 assert(sizeWithoutCookie &&
"didn't set sizeWithoutCookie?");
823 llvm_unreachable(
"bad evaluation kind");
837 unsigned InitListElements = 0;
843 llvm::Instruction *CleanupDominator =
nullptr;
850 if (
const InitListExpr *ILE = dyn_cast<InitListExpr>(Init)) {
851 InitListElements = ILE->getNumInits();
873 ElementType, ElementAlign,
879 for (
unsigned i = 0, e = ILE->getNumInits(); i != e; ++i) {
892 ILE->getInit(i)->getType(), CurPtr);
900 Init = ILE->getArrayFiller();
909 assert(SubILE->getNumInits() == 0 &&
"explicit inits in array filler?");
910 Init = SubILE->getArrayFiller();
918 auto TryMemsetInitialization = [&]() ->
bool {
928 auto *RemainingSize = AllocSizeWithoutCookie;
929 if (InitListElements) {
931 auto *InitializedSize = llvm::ConstantInt::get(
932 RemainingSize->getType(),
935 RemainingSize =
Builder.CreateSub(RemainingSize, InitializedSize);
945 llvm::ConstantInt *ConstNum = dyn_cast<llvm::ConstantInt>(NumElements);
946 if (ConstNum && ConstNum->getZExtValue() <= InitListElements) {
948 if (CleanupDominator)
953 assert(Init &&
"have trailing elements to initialize but no initializer");
965 if (TryMemsetInitialization())
977 if (InitListElements)
978 NumElements =
Builder.CreateSub(
980 llvm::ConstantInt::get(NumElements->getType(), InitListElements));
982 CCE->requiresZeroInitialization());
988 if (isa<ImplicitValueInitExpr>(Init)) {
989 if (TryMemsetInitialization())
1001 "got wrong type of element to initialize");
1004 if (
auto *ILE = dyn_cast<InitListExpr>(Init))
1005 if (ILE->getNumInits() == 0 && TryMemsetInitialization())
1010 if (
auto *ILE = dyn_cast<InitListExpr>(Init)) {
1012 if (RType->getDecl()->isStruct()) {
1013 unsigned NumFields = 0;
1014 for (
auto *Field : RType->getDecl()->fields())
1015 if (!Field->isUnnamedBitfield())
1017 if (ILE->getNumInits() == NumFields)
1018 for (
unsigned i = 0, e = ILE->getNumInits(); i != e; ++i)
1019 if (!isa<ImplicitValueInitExpr>(ILE->getInit(i)))
1021 if (ILE->getNumInits() == NumFields && TryMemsetInitialization())
1028 llvm::BasicBlock *EntryBB =
Builder.GetInsertBlock();
1041 Builder.CreateCondBr(IsEmpty, ContBB, LoopBB);
1048 llvm::PHINode *CurPtrPhi =
1050 CurPtrPhi->addIncoming(CurPtr.
getPointer(), EntryBB);
1052 CurPtr =
Address(CurPtrPhi, ElementAlign);
1061 ElementType, ElementAlign,
1064 CleanupDominator =
Builder.CreateUnreachable();
1071 if (CleanupDominator) {
1073 CleanupDominator->eraseFromParent();
1084 Builder.CreateCondBr(IsEnd, ContBB, LoopBB);
1085 CurPtrPhi->addIncoming(NextPtr,
Builder.GetInsertBlock());
1097 AllocSizeWithoutCookie);
1108 llvm::Instruction *CallOrInvoke;
1112 Args, CalleeType,
false),
1120 llvm::Function *Fn = dyn_cast<llvm::Function>(CalleeAddr);
1121 if (Callee->isReplaceableGlobalAllocationFunction() &&
1122 Fn && Fn->hasFnAttribute(llvm::Attribute::NoBuiltin)) {
1124 if (llvm::CallInst *CI = dyn_cast<llvm::CallInst>(CallOrInvoke))
1125 CI->addAttribute(llvm::AttributeSet::FunctionIndex,
1126 llvm::Attribute::Builtin);
1127 else if (llvm::InvokeInst *II = dyn_cast<llvm::InvokeInst>(CallOrInvoke))
1128 II->addAttribute(llvm::AttributeSet::FunctionIndex,
1129 llvm::Attribute::Builtin);
1131 llvm_unreachable(
"unexpected kind of call instruction");
1141 const Stmt *ArgS = Arg;
1146 .getCXXOperatorName(IsDelete ? OO_Delete : OO_New);
1148 if (
auto *FD = dyn_cast<FunctionDecl>(
Decl))
1149 if (Ctx.hasSameType(FD->getType(),
QualType(Type, 0)))
1151 llvm_unreachable(
"predeclared global operator new/delete is missing");
1158 size_t NumPlacementArgs;
1163 RValue *getPlacementArgs() {
return reinterpret_cast<RValue*
>(
this+1); }
1166 static size_t getExtraSize(
size_t NumPlacementArgs) {
1167 return NumPlacementArgs *
sizeof(
RValue);
1170 CallDeleteDuringNew(
size_t NumPlacementArgs,
1174 : NumPlacementArgs(NumPlacementArgs), OperatorDelete(OperatorDelete),
1175 Ptr(Ptr), AllocSize(AllocSize) {}
1177 void setPlacementArg(
unsigned I,
RValue Arg) {
1178 assert(I < NumPlacementArgs &&
"index out of range");
1179 getPlacementArgs()[
I] = Arg;
1199 for (
unsigned I = 0;
I != NumPlacementArgs; ++
I)
1200 DeleteArgs.
add(getPlacementArgs()[
I], *AI++);
1211 size_t NumPlacementArgs;
1221 static size_t getExtraSize(
size_t NumPlacementArgs) {
1225 CallDeleteDuringConditionalNew(
size_t NumPlacementArgs,
1229 : NumPlacementArgs(NumPlacementArgs), OperatorDelete(OperatorDelete),
1230 Ptr(Ptr), AllocSize(AllocSize) {}
1233 assert(I < NumPlacementArgs &&
"index out of range");
1234 getPlacementArgs()[
I] = Arg;
1247 DeleteArgs.
add(Ptr.restore(CGF), *AI++);
1251 RValue RV = AllocSize.restore(CGF);
1252 DeleteArgs.
add(RV, *AI++);
1256 for (
unsigned I = 0;
I != NumPlacementArgs; ++
I) {
1257 RValue RV = getPlacementArgs()[
I].restore(CGF);
1258 DeleteArgs.
add(RV, *AI++);
1277 CallDeleteDuringNew *Cleanup = CGF.
EHStack
1284 Cleanup->setPlacementArg(
I, NewArgs[
I+1].RV);
1295 CallDeleteDuringConditionalNew *Cleanup = CGF.
EHStack
1302 Cleanup->setPlacementArg(
I,
1316 unsigned minElements = 0;
1319 minElements = ILE->getNumInits();
1326 allocSizeWithoutCookie);
1377 if (allocSize != allocSizeWithoutCookie) {
1379 allocationAlign = std::max(allocationAlign, cookieAlign);
1382 allocation =
Address(RV.getScalarVal(), allocationAlign);
1392 llvm::BasicBlock *nullCheckBB =
nullptr;
1393 llvm::BasicBlock *contBB =
nullptr;
1400 conditional.
begin(*
this);
1402 nullCheckBB =
Builder.GetInsertBlock();
1408 Builder.CreateCondBr(isNull, contBB, notNullBB);
1415 llvm::Instruction *cleanupDominator =
nullptr;
1420 cleanupDominator =
Builder.CreateUnreachable();
1423 assert((allocSize == allocSizeWithoutCookie) ==
1425 if (allocSize != allocSizeWithoutCookie) {
1444 allocSizeWithoutCookie);
1450 if (result.
getType() != resultType)
1456 if (operatorDeleteCleanup.
isValid()) {
1458 cleanupDominator->eraseFromParent();
1463 conditional.
end(*
this);
1465 llvm::BasicBlock *notNullBB =
Builder.GetInsertBlock();
1468 llvm::PHINode *PHI =
Builder.CreatePHI(resultPtr->getType(), 2);
1469 PHI->addIncoming(resultPtr, notNullBB);
1470 PHI->addIncoming(llvm::Constant::getNullValue(resultPtr->getType()),
1492 if (DeleteFTy->getNumParams() == 2) {
1493 SizeTy = DeleteFTy->getParamType(1);
1495 Size = llvm::ConstantInt::get(
ConvertType(SizeTy),
1499 QualType ArgTy = DeleteFTy->getParamType(0);
1520 : Ptr(Ptr), OperatorDelete(OperatorDelete), ElementType(ElementType) {}
1533 OperatorDelete, ElementType);
1563 OperatorDelete, ElementType);
1604 : Ptr(Ptr), OperatorDelete(OperatorDelete), NumElements(NumElements),
1605 ElementType(ElementType), CookieSize(CookieSize) {}
1623 llvm::IntegerType *SizeTy
1624 = cast<llvm::IntegerType>(CGF.
ConvertType(
size_t));
1631 = llvm::ConstantInt::get(SizeTy, ElementTypeSize.getQuantity());
1633 Size = CGF.
Builder.CreateMul(Size, NumElements);
1636 if (!CookieSize.isZero()) {
1638 = llvm::ConstantInt::get(SizeTy, CookieSize.getQuantity());
1639 Size = CGF.
Builder.CreateAdd(Size, CookieSizeV);
1660 numElements, allocatedPtr, cookieSize);
1662 assert(allocatedPtr &&
"ReadArrayCookie didn't set allocated pointer");
1667 allocatedPtr, operatorDelete,
1668 numElements, elementType,
1673 assert(numElements &&
"no element count for a type with a destructor!");
1681 CGF.
Builder.CreateInBoundsGEP(arrayBegin, numElements,
"delete.end");
1706 Builder.CreateCondBr(IsNull, DeleteEnd, DeleteNotNull);
1717 GEP.push_back(Zero);
1721 =
getContext().getAsConstantArrayType(DeleteTy)) {
1723 DeleteTy = Arr->getElementType();
1726 GEP.push_back(Zero);
1747 if (
const auto *CE = dyn_cast<CastExpr>(E)) {
1748 if (!CE->getSubExpr()->isGLValue())
1753 if (
const auto *OVE = dyn_cast<OpaqueValueExpr>(E))
1756 if (
const auto *BO = dyn_cast<BinaryOperator>(E))
1760 if (
const auto *ACO = dyn_cast<AbstractConditionalOperator>(E))
1766 if (isa<ArraySubscriptExpr>(E))
1769 if (
const auto *UO = dyn_cast<UnaryOperator>(E))
1792 llvm::BasicBlock *BadTypeidBlock =
1797 CGF.
Builder.CreateCondBr(IsNull, BadTypeidBlock, EndBlock);
1836 return llvm::Constant::getNullValue(DestLTy);
1844 return llvm::UndefValue::get(DestLTy);
1863 bool isDynamicCastToVoid;
1871 isDynamicCastToVoid =
false;
1872 SrcRecordTy = SrcTy;
1876 assert(SrcRecordTy->
isRecordType() &&
"source type must be a record type!");
1881 bool ShouldNullCheckSrcValue =
1885 llvm::BasicBlock *CastNull =
nullptr;
1886 llvm::BasicBlock *CastNotNull =
nullptr;
1889 if (ShouldNullCheckSrcValue) {
1894 Builder.CreateCondBr(IsNull, CastNull, CastNotNull);
1899 if (isDynamicCastToVoid) {
1904 "destination type must be a record type!");
1906 DestTy, DestRecordTy, CastEnd);
1907 CastNotNull =
Builder.GetInsertBlock();
1910 if (ShouldNullCheckSrcValue) {
1919 if (ShouldNullCheckSrcValue) {
1920 llvm::PHINode *PHI =
Builder.CreatePHI(Value->getType(), 2);
1921 PHI->addIncoming(Value, CastNotNull);
1922 PHI->addIncoming(llvm::Constant::getNullValue(Value->getType()), CastNull);
1937 i != e; ++i, ++CurField) {
1940 if (CurField->hasCapturedVLAType()) {
1941 auto VAT = CurField->getCapturedVLAType();
1945 if (CurField->getType()->isArrayType())
A call to an overloaded operator written using operator syntax.
void EmitInitializerForField(FieldDecl *Field, LValue LHS, Expr *Init, ArrayRef< VarDecl * > ArrayIndexes)
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
ReturnValueSlot - Contains the address where the return value of a function can be stored...
virtual llvm::Value * EmitVirtualDestructorCall(CodeGenFunction &CGF, const CXXDestructorDecl *Dtor, CXXDtorType DtorType, Address This, const CXXMemberCallExpr *CE)=0
Emit the ABI-specific virtual destructor call.
bool isNegative() const
isNegative - Test whether the quantity is less than zero.
virtual void EmitBadTypeidCall(CodeGenFunction &CGF)=0
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
void end(CodeGenFunction &CGF)
void EmitCallArgs(CallArgList &Args, const T *CallArgTypeInfo, llvm::iterator_range< CallExpr::const_arg_iterator > ArgRange, const FunctionDecl *CalleeDecl=nullptr, unsigned ParamsToSkip=0)
EmitCallArgs - Emit call arguments for a function.
PointerType - C99 6.7.5.1 - Pointer Declarators.
llvm::iterator_range< arg_iterator > placement_arguments()
Destroyer * getDestroyer(QualType::DestructionKind destructionKind)
A (possibly-)qualified type.
bool isConstantArrayType() const
void EmitVTablePtrCheckForCall(const CXXMethodDecl *MD, llvm::Value *VTable, CFITypeCheckKind TCK, SourceLocation Loc)
EmitVTablePtrCheckForCall - Virtual method MD is being called via VTable.
CodeGenTypes & getTypes()
llvm::Type * ConvertTypeForMem(QualType T)
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
CXXCtorType getCtorType() const
bool isElidable() const
Whether this construction is elidable.
llvm::Module & getModule() const
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
void EmitARCDestroyWeak(Address addr)
void @objc_destroyWeak(i8** addr) Essentially objc_storeWeak(addr, nil).
bool isOne() const
isOne - Test whether the quantity equals one.
bool isInConditionalBranch() const
isInConditionalBranch - Return true if we're currently emitting one branch or the other of a conditio...
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 EmitNewArrayInitializer(const CXXNewExpr *E, QualType elementType, llvm::Type *ElementTy, Address NewPtr, llvm::Value *NumElements, llvm::Value *AllocSizeWithoutCookie)
llvm::ConstantInt * getSize(CharUnits N)
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
virtual bool shouldTypeidBeNullChecked(bool IsDeref, QualType SrcRecordTy)=0
llvm::AllocaInst * CreateTempAlloca(llvm::Type *Ty, const Twine &Name="tmp")
CreateTempAlloca - This creates a alloca and inserts it into the entry block.
Checking the 'this' pointer for a constructor call.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
bool isRecordType() const
Decl - This represents one declaration (or definition), e.g.
Address getAddress() const
virtual bool shouldDynamicCastCallBeNullChecked(bool SrcIsPtr, QualType SrcRecordTy)=0
bool hasDefinition() const
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
QualType getPointeeType() const
The base class of the type hierarchy.
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit)
EmitComplexExprIntoLValue - Emit the given expression of complex type and place its result into the s...
QualType getRecordType(const RecordDecl *Decl) const
Represents a call to a C++ constructor.
RValue EmitCXXMemberCallExpr(const CXXMemberCallExpr *E, ReturnValueSlot ReturnValue)
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const LangOptions & getLangOpts() const
LValue EmitLValueForFieldInitialization(LValue Base, const FieldDecl *Field)
EmitLValueForFieldInitialization - Like EmitLValueForField, except that if the Field is a reference...
static RValue EmitNewDeleteCall(CodeGenFunction &CGF, const FunctionDecl *Callee, const FunctionProtoType *CalleeType, const CallArgList &Args)
Emit a call to an operator new or operator delete function, as implicitly created by new-expressions ...
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Represents a C++ constructor within a class.
Expr * ignoreParenBaseCasts() LLVM_READONLY
Ignore parentheses and derived-to-base casts.
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
static llvm::Value * EmitCXXNewAllocSize(CodeGenFunction &CGF, const CXXNewExpr *e, unsigned minElements, llvm::Value *&numElements, llvm::Value *&sizeWithoutCookie)
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
static saved_type save(CodeGenFunction &CGF, type value)
llvm::Type * getElementType() const
Return the type of the values stored in this address.
const Expr * getCallee() const
T * pushCleanupWithExtra(CleanupKind Kind, size_t N, As...A)
Push a cleanup with non-constant storage requirements on the stack.
virtual llvm::Value * getVirtualFunctionPointer(CodeGenFunction &CGF, GlobalDecl GD, Address This, llvm::Type *Ty, SourceLocation Loc)=0
Build a virtual function pointer in the ABI-specific way.
field_iterator field_begin() const
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Given a pointer to i8, adjust it by a given constant offset.
const CGFunctionInfo & arrangeCXXStructorDeclaration(const CXXMethodDecl *MD, StructorType Type)
IsZeroed_t isZeroed() const
RValue EmitCUDAKernelCallExpr(const CUDAKernelCallExpr *E, ReturnValueSlot ReturnValue)
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
unsigned getNumParams() const
An object to manage conditionally-evaluated expressions.
llvm::Value * EmitCXXNewExpr(const CXXNewExpr *E)
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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 ...
llvm::Value * EmitDynamicCast(Address V, const CXXDynamicCastExpr *DCE)
void EmitSynthesizedCXXCopyCtorCall(const CXXConstructorDecl *D, Address This, Address Src, const CXXConstructExpr *E)
QualType getReturnType() const
static llvm::Value * EmitTypeidFromVTable(CodeGenFunction &CGF, const Expr *E, llvm::Type *StdTypeInfoPtrTy)
llvm::IntegerType * SizeTy
Denotes a cleanup that should run when a scope is exited using exceptional control flow (a throw stat...
bool isPotentiallyEvaluated() const
Determine whether this typeid has a type operand which is potentially evaluated, per C++11 [expr...
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
A metaprogramming class for ensuring that a value will dominate an arbitrary position in a function...
RValue EmitCall(const CGFunctionInfo &FnInfo, llvm::Value *Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, CGCalleeInfo CalleeInfo=CGCalleeInfo(), llvm::Instruction **callOrInvoke=nullptr)
EmitCall - Generate a call of the given function, expecting the given result type, and using the given argument list which specifies both the LLVM arguments and the types they were derived from.
void EmitCXXConstructorCall(const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, Address This, const CXXConstructExpr *E)
virtual RValue EmitCUDAKernelCallExpr(CodeGenFunction &CGF, const CUDAKernelCallExpr *E, ReturnValueSlot ReturnValue)
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
void pushRegularPartialArrayCleanup(llvm::Value *arrayBegin, llvm::Value *arrayEnd, QualType elementType, CharUnits elementAlignment, Destroyer *destroyer)
pushRegularPartialArrayCleanup - Push an EH cleanup to destroy already-constructed elements of the gi...
CGCUDARuntime & getCUDARuntime()
Return a reference to the configured CUDA runtime.
bool isAlwaysNull() const
isAlwaysNull - Return whether the result of the dynamic_cast is proven to always be null...
Address CreateElementBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Cast the element type of the given address to a different type, preserving information like the align...
CharUnits - This is an opaque type for sizes expressed in character units.
void EmitARCDestroyStrong(Address addr, ARCPreciseLifetime_t precise)
Destroy a __strong variable.
ArrayRef< VarDecl * > getCaptureInitIndexVars(const_capture_init_iterator Iter) const
Retrieve the set of index variables used in the capture initializer of an array captured by copy...
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isDefaulted() const
Whether this function is defaulted per C++0x.
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Expr * getInitializer()
The initializer of this new-expression.
Expr * getExprOperand() const
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, QualType DestTy)=0
A builtin binary operation expression such as "x + y" or "x <= y".
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind...
RecordDecl * getDecl() const
CharUnits getPointerSize() const
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
void EmitAggregateAssign(Address DestPtr, Address SrcPtr, QualType EltTy)
EmitAggregateCopy - Emit an aggregate assignment.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Scope - A scope is a transient data structure that is used while parsing the program.
static void StoreAnyExprIntoOneUnit(CodeGenFunction &CGF, const Expr *Init, QualType AllocType, Address NewPtr)
void initFullExprCleanup()
Set up the last cleaup that was pushed as a conditional full-expression cleanup.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
static void EmitNullBaseClassInitialization(CodeGenFunction &CGF, Address DestPtr, const CXXRecordDecl *Base)
static RequiredArgs commonEmitCXXMemberOrOperatorCall(CodeGenFunction &CGF, const CXXMethodDecl *MD, llvm::Value *Callee, ReturnValueSlot ReturnValue, llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *CE, CallArgList &Args)
void EmitDeleteCall(const FunctionDecl *DeleteFD, llvm::Value *Ptr, QualType DeleteTy)
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
const CGFunctionInfo & arrangeCXXMethodDeclaration(const CXXMethodDecl *MD)
Arrange the argument and result information for a declaration or definition of the given C++ non-stat...
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
detail::InMemoryDirectory::const_iterator I
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
void begin(CodeGenFunction &CGF)
This object can be modified without requiring retains or releases.
Checking the 'this' pointer for a call to a non-static member function.
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource AlignSource=AlignmentSource::Type)
FunctionDecl * getOperatorDelete() const
void EmitCXXConstructExpr(const CXXConstructExpr *E, AggValueSlot Dest)
QualType getParamType(unsigned i) const
Represents a prototype with parameter type info, e.g.
virtual CharUnits GetArrayCookieSize(const CXXNewExpr *expr)
Returns the extra size required in order to store the array cookie for the given new-expression.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
param_type_iterator param_type_begin() const
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
FunctionDecl * getOperatorDelete() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
llvm::Value * GetVTablePtr(Address This, llvm::Type *VTableTy, const CXXRecordDecl *VTableClass)
GetVTablePtr - Return the Value of the vtable pointer member pointed to by This.
static TypeEvaluationKind getEvaluationKind(QualType T)
hasAggregateLLVMType - Return true if the specified AST type will map into an aggregate LLVM type or ...
llvm::Value * getPointer() const
Expr - This represents one expression.
bool CanDevirtualizeMemberFunctionCall(const Expr *Base, const CXXMethodDecl *MD)
CanDevirtualizeMemberFunctionCalls - Checks whether virtual calls on given expr can be devirtualized...
CGCXXABI & getCXXABI() const
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.
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited...
RValue EmitCXXMemberOrOperatorCall(const CXXMethodDecl *MD, llvm::Value *Callee, ReturnValueSlot ReturnValue, llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *E)
void pushCallObjectDeleteCleanup(const FunctionDecl *OperatorDelete, llvm::Value *CompletePtr, QualType ElementType)
Represents a C++ destructor within a class.
CharUnits getNonVirtualAlignment() const
getNonVirtualSize - Get the non-virtual alignment (in chars) of an object, which is the alignment of ...
virtual bool EmitBadCastCall(CodeGenFunction &CGF)=0
ASTContext & getContext() const
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
void add(RValue rvalue, QualType type, bool needscopy=false)
stable_iterator stable_begin() const
Create a stable reference to the top of the EH stack.
A class for recording the number of arguments that a function signature requires. ...
bool shouldNullCheckAllocation(const ASTContext &Ctx) const
True if the allocation result needs to be null-checked.
QualType getAllocatedType() const
void EmitLambdaExpr(const LambdaExpr *E, AggValueSlot Dest)
RValue EmitCXXMemberOrOperatorMemberCallExpr(const CallExpr *CE, const CXXMethodDecl *MD, ReturnValueSlot ReturnValue, bool HasQualifier, NestedNameSpecifier *Qualifier, bool IsArrow, const Expr *Base)
Address EmitPointerWithAlignment(const Expr *Addr, AlignmentSource *Source=nullptr)
EmitPointerWithAlignment - Given an expression with a pointer type, emit the value and compute our be...
static void EmitObjectDelete(CodeGenFunction &CGF, const CXXDeleteExpr *DE, Address Ptr, QualType ElementType)
Emit the code for deleting a single object.
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
llvm::Value * EmitCastToVoidPtr(llvm::Value *value)
Emit a cast to void* in the appropriate address space.
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys=None)
void emitArrayDestroy(llvm::Value *begin, llvm::Value *end, QualType elementType, CharUnits elementAlign, Destroyer *destroyer, bool checkZeroLength, bool useEHCleanup)
emitArrayDestroy - Destroys all the elements of the given array, beginning from last to first...
CharUnits getSizeAlign() const
void EmitCXXAggrConstructorCall(const CXXConstructorDecl *D, const ConstantArrayType *ArrayTy, Address ArrayPtr, const CXXConstructExpr *E, bool ZeroInitialization=false)
EmitCXXAggrConstructorCall - Emit a loop to call a particular constructor for each of several members...
static AggValueSlot forAddr(Address addr, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
forAddr - Make a slot for an aggregate value.
GlobalDecl - represents a global declaration.
The l-value was considered opaque, so the alignment was determined from a type.
There is no lifetime qualification on this type.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Address CreateBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
Assigning into this object requires the old value to be released and the new value to be retained...
bool mayInsertExtraPadding(bool EmitRemark=false) const
Whether we are allowed to insert extra padding between fields.
llvm::Value * EmitCXXTypeidExpr(const CXXTypeidExpr *E)
ASTContext & getContext() const
Encodes a location in the source.
CharUnits getPointerAlign() const
virtual llvm::Value * EmitTypeid(CodeGenFunction &CGF, QualType SrcRecordTy, Address ThisPtr, llvm::Type *StdTypeInfoPtrTy)=0
A saved depth on the scope stack.
static CXXRecordDecl * getCXXRecord(const Expr *E)
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...
void DeactivateCleanupBlock(EHScopeStack::stable_iterator Cleanup, llvm::Instruction *DominatingIP)
DeactivateCleanupBlock - Deactivates the given cleanup block.
A scoped helper to set the current debug location to the specified location or preferred location of ...
static void EmitArrayDelete(CodeGenFunction &CGF, const CXXDeleteExpr *E, Address deletedPtr, QualType elementType)
Emit the code for deleting an array of objects.
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
llvm::Constant * EmitNullConstantForBase(const CXXRecordDecl *Record)
Return a null constant appropriate for zero-initializing a base class with the given type...
SanitizerSet SanOpts
Sanitizers enabled for this function.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
llvm::Constant * GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH=false)
Get the address of the RTTI descriptor for the given type.
bool hasInitializer() const
Whether this new-expression has any initializer at all.
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
const CodeGenOptions & getCodeGenOpts() const
virtual void emitVirtualObjectDelete(CodeGenFunction &CGF, const CXXDeleteExpr *DE, Address Ptr, QualType ElementType, const CXXDestructorDecl *Dtor)=0
const T * castAs() const
Member-template castAs<specific type>.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E, ReturnValueSlot ReturnValue)
llvm::Constant * getAddrOfCXXStructor(const CXXMethodDecl *MD, StructorType Type, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, bool IsForDefinition=false)
Return the address of the constructor/destructor of the given type.
Assigning into this object requires a lifetime extension.
RValue EmitBuiltinNewDeleteCall(const FunctionProtoType *Type, const Expr *Arg, bool IsDelete)
const CGFunctionInfo & arrangeCXXMethodCall(const CallArgList &args, const FunctionProtoType *type, RequiredArgs required)
Arrange a call to a C++ method, passing the given arguments.
bool isDynamicClass() const
CXXCtorType
C++ constructor types.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
QualType getPointeeType() const
virtual Address InitializeArrayCookie(CodeGenFunction &CGF, Address NewPtr, llvm::Value *NumElements, const CXXNewExpr *expr, QualType ElementType)
Initialize the array cookie for the given allocation.
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type, returning the result.
static CharUnits CalculateCookiePadding(CodeGenFunction &CGF, const CXXNewExpr *E)
CGFunctionInfo - Class to encapsulate the information about a function definition.
CharUnits getAlignment() const
Return the alignment of this pointer.
void EmitCXXDestructorCall(const CXXDestructorDecl *D, CXXDtorType Type, bool ForVirtualBase, bool Delegating, Address This)
static void EnterNewDeleteCleanup(CodeGenFunction &CGF, const CXXNewExpr *E, Address NewPtr, llvm::Value *AllocSize, const CallArgList &NewArgs)
Enter a cleanup to call 'operator delete' if the initializer in a new-expression throws.
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
bool isZero() const
isZero - Test whether the quantity equals zero.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return 0.
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const
Determine whether the result of this expression is a temporary object of the given class type...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
DeclarationName - The name of a declaration.
unsigned getNumPlacementArgs() const
detail::InMemoryDirectory::const_iterator E
A pointer to member type per C++ 8.3.3 - Pointers to members.
void EmitAggregateCopy(Address DestPtr, Address SrcPtr, QualType EltTy, bool isVolatile=false, bool isAssignment=false)
EmitAggregateCopy - Emit an aggregate copy.
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
void EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, llvm::Value *V, QualType Type, CharUnits Alignment=CharUnits::Zero(), bool SkipNullCheck=false)
Emit a check that V is the address of storage of the appropriate size and alignment for an object of ...
void EmitAggExpr(const Expr *E, AggValueSlot AS)
EmitAggExpr - Emit the computation of the specified expression of aggregate type. ...
void EmitExplicitCastExprType(const ExplicitCastExpr *E, CodeGenFunction *CGF=nullptr)
Emit type info if type of an expression is a variably modified type.
static llvm::Value * EmitDynamicCastToNull(CodeGenFunction &CGF, QualType DestTy)
static RequiredArgs forPrototypePlus(const FunctionProtoType *prototype, unsigned additional)
Compute the arguments required by the given formal prototype, given that there may be some additional...
llvm::PointerType * getType() const
Return the type of the pointer value.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
FunctionDecl * getOperatorNew() const
const T * getAs() const
Member-template getAs<specific type>'.
QualType getCanonicalType() const
Represents a call to a CUDA kernel function.
llvm::PointerType * Int8PtrTy
SourceLocation getLocStart() const LLVM_READONLY
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.
void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
Address getAddress() const
Expr * getArg(unsigned Arg)
Return the specified argument.
Base for LValueReferenceType and RValueReferenceType.
void EmitSynthesizedCXXCopyCtor(Address Dest, Address Src, const Expr *Exp)
CXXConstructorDecl * getConstructor() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
RValue EmitCXXStructorCall(const CXXMethodDecl *MD, llvm::Value *Callee, ReturnValueSlot ReturnValue, llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *E, StructorType Type)
static bool isGLValueFromPointerDeref(const Expr *E)
llvm::ConstantInt * getSize(CharUnits numChars)
Emit the given number of characters as a value of type size_t.
const Type * getClass() const
Reading or writing from this object requires a barrier call.
bool isPODType(ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
llvm::Value * BuildAppleKextVirtualCall(const CXXMethodDecl *MD, NestedNameSpecifier *Qual, llvm::Type *Ty)
BuildAppleKextVirtualCall - This routine is to support gcc's kext ABI making indirect call to virtual...
Represents a C++ struct/union/class.
void EmitBranch(llvm::BasicBlock *Block)
EmitBranch - Emit a branch to the specified basic block from the current insert block, taking care to avoid creation of branches from dummy blocks.
CharUnits alignmentAtOffset(CharUnits offset) const
Given that this is a non-zero alignment value, what is the alignment at the given offset...
static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E, QualType ElementType, llvm::Type *ElementTy, Address NewPtr, llvm::Value *NumElements, llvm::Value *AllocSizeWithoutCookie)
llvm::Type * ConvertType(QualType T)
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
void EmitCXXDeleteExpr(const CXXDeleteExpr *E)
LValue EmitLValue(const Expr *E)
EmitLValue - Emit code to compute a designator that specifies the location of the expression...
bool isReservedGlobalPlacementOperator() const
Determines whether this operator new or delete is one of the reserved global placement operators: voi...
Address ReturnValue
ReturnValue - The temporary alloca to hold the return value.
virtual llvm::Value * 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.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression...
static RValue get(llvm::Value *V)
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
const CGFunctionInfo & arrangeFreeFunctionCall(const CallArgList &Args, const FunctionType *Ty, bool ChainCall)
Figure out the rules for calling a function with the given formal type using the given arguments...
virtual std::vector< CharUnits > getVBPtrOffsets(const CXXRecordDecl *RD)
Gets the offsets of all the virtual base pointers in a given class.
LValue - This represents an lvalue references.
Information for lazily generating a cleanup.
bool isTypeOperand() const
RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E, const CXXMethodDecl *MD, ReturnValueSlot ReturnValue)
llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=nullptr, bool ForVTable=false, bool DontDefer=false, bool IsForDefinition=false)
Return the address of the given function.
TranslationUnitDecl * getTranslationUnitDecl()
CallArgList - Type for representing both the value and type of arguments in a call.
void PopCleanupBlock(bool FallThroughIsBranchThrough=false)
PopCleanupBlock - Will pop the cleanup entry on the stack and process all branch fixups.
Represents the canonical version of C arrays with a specified constant size.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
bool isZeroInitializable(QualType T)
IsZeroInitializable - Return whether a type can be zero-initialized (in the C++ sense) with an LLVM z...
Represents an implicitly-generated value initialization of an object of a given type.
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
void pushIrregularPartialArrayCleanup(llvm::Value *arrayBegin, Address arrayEndPointer, QualType elementType, CharUnits elementAlignment, Destroyer *destroyer)
pushIrregularPartialArrayCleanup - Push an EH cleanup to destroy already-constructed elements of the ...
void EmitNullInitialization(Address DestPtr, QualType Ty)
EmitNullInitialization - Generate code to set a value of the given type to null, If the type contains...
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isPointerType() const
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any...
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.