21 #include "llvm/IR/CallSite.h"
22 #include "llvm/IR/Intrinsics.h"
24 using namespace clang;
25 using namespace CodeGen;
32 assert(CE ==
nullptr || isa<CXXMemberCallExpr>(CE) ||
33 isa<CXXOperatorCallExpr>(CE));
35 "Trying to emit a member or operator call expr on a static method!");
62 unsigned ArgsToSkip = isa<CXXOperatorCallExpr>(CE) ? 1 : 0;
68 "No CallExpr specified for function with non-zero number of arguments");
80 *
this, MD, This, ImplicitParam, ImplicitParamTy, CE, Args);
91 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) {
268 else if (!DevirtualizedMethod)
277 *
this, CalleeDecl, This, UseVirtualCall);
317 ThisPtrForCall, MemFnPtr, MPT);
341 "Trying to emit a member call expr on a static method!");
343 E, MD, ReturnValue,
false,
nullptr,
371 std::vector<CharUnits> VBPtrOffsets =
373 for (
CharUnits VBPtrOffset : VBPtrOffsets) {
375 if (VBPtrOffset >= NVSize)
377 std::pair<CharUnits, CharUnits> LastStore = Stores.pop_back_val();
378 CharUnits LastStoreOffset = LastStore.first;
379 CharUnits LastStoreSize = LastStore.second;
381 CharUnits SplitBeforeOffset = LastStoreOffset;
382 CharUnits SplitBeforeSize = VBPtrOffset - SplitBeforeOffset;
383 assert(!SplitBeforeSize.
isNegative() &&
"negative store size!");
384 if (!SplitBeforeSize.
isZero())
385 Stores.emplace_back(SplitBeforeOffset, SplitBeforeSize);
387 CharUnits SplitAfterOffset = VBPtrOffset + VBPtrWidth;
388 CharUnits SplitAfterSize = LastStoreSize - SplitAfterOffset;
389 assert(!SplitAfterSize.
isNegative() &&
"negative store size!");
390 if (!SplitAfterSize.
isZero())
391 Stores.emplace_back(SplitAfterOffset, SplitAfterSize);
401 if (!NullConstantForBase->isNullValue()) {
402 llvm::GlobalVariable *NullVariable =
new llvm::GlobalVariable(
404 true, llvm::GlobalVariable::PrivateLinkage,
405 NullConstantForBase, Twine());
409 NullVariable->setAlignment(Align.getQuantity());
414 for (std::pair<CharUnits, CharUnits>
Store : Stores) {
428 for (std::pair<CharUnits, CharUnits>
Store : Stores) {
434 CGF.
Builder.getInt8(0), StoreSizeVal);
442 assert(!Dest.
isIgnored() &&
"Must have a destination!");
464 if (CD->isTrivial() && CD->isDefaultConstructor())
484 bool ForVirtualBase =
false;
485 bool Delegating =
false;
499 ForVirtualBase =
true;
515 Exp =
E->getSubExpr();
516 assert(isa<CXXConstructExpr>(Exp) &&
517 "EmitSynthesizedCXXCopyCtor - unknown copy ctor expr");
530 &&
"EmitSynthesizedCXXCopyCtor - Copied-in Array");
549 unsigned minElements,
558 return sizeWithoutCookie;
562 unsigned sizeWidth = CGF.
SizeTy->getBitWidth();
565 llvm::APInt cookieSize(sizeWidth,
572 assert(isa<llvm::IntegerType>(numElements->getType()));
582 llvm::IntegerType *numElementsType
583 = cast<llvm::IntegerType>(numElements->getType());
584 unsigned numElementsWidth = numElementsType->getBitWidth();
587 llvm::APInt arraySizeMultiplier(sizeWidth, 1);
590 type = CAT->getElementType();
591 arraySizeMultiplier *= CAT->getSize();
595 llvm::APInt typeSizeMultiplier(sizeWidth, typeSize.
getQuantity());
596 typeSizeMultiplier *= arraySizeMultiplier;
603 if (llvm::ConstantInt *numElementsC =
604 dyn_cast<llvm::ConstantInt>(numElements)) {
605 const llvm::APInt &count = numElementsC->getValue();
607 bool hasAnyOverflow =
false;
610 if (isSigned && count.isNegative())
611 hasAnyOverflow =
true;
616 else if (numElementsWidth > sizeWidth &&
617 numElementsWidth - sizeWidth > count.countLeadingZeros())
618 hasAnyOverflow =
true;
621 llvm::APInt adjustedCount = count.zextOrTrunc(sizeWidth);
625 if (adjustedCount.ult(minElements))
626 hasAnyOverflow =
true;
631 numElements = llvm::ConstantInt::get(CGF.
SizeTy,
632 adjustedCount * arraySizeMultiplier);
636 llvm::APInt allocationSize
637 = adjustedCount.umul_ov(typeSizeMultiplier, overflow);
638 hasAnyOverflow |= overflow;
641 if (cookieSize != 0) {
644 sizeWithoutCookie = llvm::ConstantInt::get(CGF.
SizeTy, allocationSize);
646 allocationSize = allocationSize.uadd_ov(cookieSize, overflow);
647 hasAnyOverflow |= overflow;
651 if (hasAnyOverflow) {
652 size = llvm::Constant::getAllOnesValue(CGF.
SizeTy);
654 size = llvm::ConstantInt::get(CGF.
SizeTy, allocationSize);
677 if (numElementsWidth > sizeWidth) {
678 llvm::APInt threshold(numElementsWidth, 1);
679 threshold <<= sizeWidth;
682 = llvm::ConstantInt::get(numElementsType, threshold);
684 hasOverflow = CGF.
Builder.CreateICmpUGE(numElements, thresholdV);
685 numElements = CGF.
Builder.CreateTrunc(numElements, CGF.
SizeTy);
688 }
else if (isSigned) {
689 if (numElementsWidth < sizeWidth)
690 numElements = CGF.
Builder.CreateSExt(numElements, CGF.
SizeTy);
697 if (typeSizeMultiplier == 1)
698 hasOverflow = CGF.
Builder.CreateICmpSLT(numElements,
699 llvm::ConstantInt::get(CGF.
SizeTy, minElements));
702 }
else if (numElementsWidth < sizeWidth) {
703 numElements = CGF.
Builder.CreateZExt(numElements, CGF.
SizeTy);
706 assert(numElements->getType() == CGF.
SizeTy);
711 hasOverflow = CGF.
Builder.CreateICmpULT(numElements,
712 llvm::ConstantInt::get(CGF.
SizeTy, minElements));
713 }
else if (numElementsWidth > sizeWidth) {
717 hasOverflow = CGF.
Builder.CreateOr(hasOverflow,
718 CGF.
Builder.CreateICmpULT(numElements,
719 llvm::ConstantInt::get(CGF.
SizeTy, minElements)));
732 if (typeSizeMultiplier != 1) {
737 llvm::ConstantInt::get(CGF.
SizeTy, typeSizeMultiplier);
739 CGF.
Builder.CreateCall(umul_with_overflow, {size, tsmV});
743 hasOverflow = CGF.
Builder.CreateOr(hasOverflow, overflowed);
745 hasOverflow = overflowed;
747 size = CGF.
Builder.CreateExtractValue(result, 0);
750 if (arraySizeMultiplier != 1) {
753 if (typeSize.
isOne()) {
754 assert(arraySizeMultiplier == typeSizeMultiplier);
760 llvm::ConstantInt::get(CGF.
SizeTy, arraySizeMultiplier);
761 numElements = CGF.
Builder.CreateMul(numElements, asmV);
766 assert(arraySizeMultiplier == 1);
770 if (cookieSize != 0) {
771 sizeWithoutCookie = size;
778 CGF.
Builder.CreateCall(uadd_with_overflow, {size, cookieSizeV});
782 hasOverflow = CGF.
Builder.CreateOr(hasOverflow, overflowed);
784 hasOverflow = overflowed;
786 size = CGF.
Builder.CreateExtractValue(result, 0);
793 size = CGF.
Builder.CreateSelect(hasOverflow,
794 llvm::Constant::getAllOnesValue(CGF.
SizeTy),
799 sizeWithoutCookie = size;
801 assert(sizeWithoutCookie &&
"didn't set sizeWithoutCookie?");
828 llvm_unreachable(
"bad evaluation kind");
842 unsigned InitListElements = 0;
848 llvm::Instruction *CleanupDominator =
nullptr;
855 if (
const InitListExpr *ILE = dyn_cast<InitListExpr>(Init)) {
856 InitListElements = ILE->getNumInits();
878 ElementType, ElementAlign,
884 for (
unsigned i = 0, e = ILE->getNumInits(); i != e; ++i) {
897 ILE->getInit(i)->getType(), CurPtr);
905 Init = ILE->getArrayFiller();
914 assert(SubILE->getNumInits() == 0 &&
"explicit inits in array filler?");
915 Init = SubILE->getArrayFiller();
923 auto TryMemsetInitialization = [&]() ->
bool {
933 auto *RemainingSize = AllocSizeWithoutCookie;
934 if (InitListElements) {
936 auto *InitializedSize = llvm::ConstantInt::get(
937 RemainingSize->getType(),
940 RemainingSize =
Builder.CreateSub(RemainingSize, InitializedSize);
950 llvm::ConstantInt *ConstNum = dyn_cast<llvm::ConstantInt>(NumElements);
951 if (ConstNum && ConstNum->getZExtValue() <= InitListElements) {
953 if (CleanupDominator)
958 assert(Init &&
"have trailing elements to initialize but no initializer");
970 if (TryMemsetInitialization())
982 if (InitListElements)
983 NumElements =
Builder.CreateSub(
985 llvm::ConstantInt::get(NumElements->getType(), InitListElements));
987 CCE->requiresZeroInitialization());
993 if (isa<ImplicitValueInitExpr>(Init)) {
994 if (TryMemsetInitialization())
1006 "got wrong type of element to initialize");
1009 if (
auto *ILE = dyn_cast<InitListExpr>(Init))
1010 if (ILE->getNumInits() == 0 && TryMemsetInitialization())
1015 if (
auto *ILE = dyn_cast<InitListExpr>(Init)) {
1017 if (RType->getDecl()->isStruct()) {
1018 unsigned NumElements = 0;
1019 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(RType->getDecl()))
1020 NumElements = CXXRD->getNumBases();
1021 for (
auto *Field : RType->getDecl()->fields())
1022 if (!Field->isUnnamedBitfield())
1025 if (ILE->getNumInits() == NumElements)
1026 for (
unsigned i = 0, e = ILE->getNumInits(); i != e; ++i)
1027 if (!isa<ImplicitValueInitExpr>(ILE->getInit(i)))
1029 if (ILE->getNumInits() == NumElements && TryMemsetInitialization())
1036 llvm::BasicBlock *EntryBB =
Builder.GetInsertBlock();
1049 Builder.CreateCondBr(IsEmpty, ContBB, LoopBB);
1056 llvm::PHINode *CurPtrPhi =
1058 CurPtrPhi->addIncoming(CurPtr.
getPointer(), EntryBB);
1060 CurPtr =
Address(CurPtrPhi, ElementAlign);
1069 ElementType, ElementAlign,
1072 CleanupDominator =
Builder.CreateUnreachable();
1079 if (CleanupDominator) {
1081 CleanupDominator->eraseFromParent();
1092 Builder.CreateCondBr(IsEnd, ContBB, LoopBB);
1093 CurPtrPhi->addIncoming(NextPtr,
Builder.GetInsertBlock());
1105 AllocSizeWithoutCookie);
1116 llvm::Instruction *CallOrInvoke;
1120 Args, CalleeType,
false),
1128 llvm::Function *Fn = dyn_cast<llvm::Function>(CalleeAddr);
1129 if (Callee->isReplaceableGlobalAllocationFunction() &&
1130 Fn && Fn->hasFnAttribute(llvm::Attribute::NoBuiltin)) {
1132 if (llvm::CallInst *CI = dyn_cast<llvm::CallInst>(CallOrInvoke))
1133 CI->addAttribute(llvm::AttributeSet::FunctionIndex,
1134 llvm::Attribute::Builtin);
1135 else if (llvm::InvokeInst *II = dyn_cast<llvm::InvokeInst>(CallOrInvoke))
1136 II->addAttribute(llvm::AttributeSet::FunctionIndex,
1137 llvm::Attribute::Builtin);
1139 llvm_unreachable(
"unexpected kind of call instruction");
1149 const Stmt *ArgS = Arg;
1154 .getCXXOperatorName(IsDelete ? OO_Delete : OO_New);
1155 for (
auto *
Decl : Ctx.getTranslationUnitDecl()->lookup(Name))
1156 if (
auto *FD = dyn_cast<FunctionDecl>(
Decl))
1157 if (Ctx.hasSameType(FD->getType(),
QualType(Type, 0)))
1159 llvm_unreachable(
"predeclared global operator new/delete is missing");
1166 size_t NumPlacementArgs;
1171 RValue *getPlacementArgs() {
return reinterpret_cast<RValue*
>(
this+1); }
1174 static size_t getExtraSize(
size_t NumPlacementArgs) {
1175 return NumPlacementArgs *
sizeof(
RValue);
1178 CallDeleteDuringNew(
size_t NumPlacementArgs,
1182 : NumPlacementArgs(NumPlacementArgs), OperatorDelete(OperatorDelete),
1183 Ptr(Ptr), AllocSize(AllocSize) {}
1185 void setPlacementArg(
unsigned I,
RValue Arg) {
1186 assert(I < NumPlacementArgs &&
"index out of range");
1187 getPlacementArgs()[
I] = Arg;
1207 for (
unsigned I = 0;
I != NumPlacementArgs; ++
I)
1208 DeleteArgs.
add(getPlacementArgs()[
I], *AI++);
1219 size_t NumPlacementArgs;
1229 static size_t getExtraSize(
size_t NumPlacementArgs) {
1233 CallDeleteDuringConditionalNew(
size_t NumPlacementArgs,
1237 : NumPlacementArgs(NumPlacementArgs), OperatorDelete(OperatorDelete),
1238 Ptr(Ptr), AllocSize(AllocSize) {}
1241 assert(I < NumPlacementArgs &&
"index out of range");
1242 getPlacementArgs()[
I] = Arg;
1255 DeleteArgs.
add(Ptr.restore(CGF), *AI++);
1259 RValue RV = AllocSize.restore(CGF);
1260 DeleteArgs.
add(RV, *AI++);
1264 for (
unsigned I = 0;
I != NumPlacementArgs; ++
I) {
1265 RValue RV = getPlacementArgs()[
I].restore(CGF);
1266 DeleteArgs.
add(RV, *AI++);
1285 CallDeleteDuringNew *Cleanup = CGF.
EHStack
1292 Cleanup->setPlacementArg(
I, NewArgs[
I+1].RV);
1303 CallDeleteDuringConditionalNew *Cleanup = CGF.
EHStack
1310 Cleanup->setPlacementArg(
I,
1324 unsigned minElements = 0;
1327 minElements = ILE->getNumInits();
1334 allocSizeWithoutCookie);
1385 if (allocSize != allocSizeWithoutCookie) {
1387 allocationAlign =
std::max(allocationAlign, cookieAlign);
1390 allocation =
Address(RV.getScalarVal(), allocationAlign);
1400 llvm::BasicBlock *nullCheckBB =
nullptr;
1401 llvm::BasicBlock *contBB =
nullptr;
1408 conditional.
begin(*
this);
1410 nullCheckBB =
Builder.GetInsertBlock();
1416 Builder.CreateCondBr(isNull, contBB, notNullBB);
1423 llvm::Instruction *cleanupDominator =
nullptr;
1428 cleanupDominator =
Builder.CreateUnreachable();
1431 assert((allocSize == allocSizeWithoutCookie) ==
1433 if (allocSize != allocSizeWithoutCookie) {
1452 allocSizeWithoutCookie);
1458 if (result.
getType() != resultType)
1464 if (operatorDeleteCleanup.
isValid()) {
1466 cleanupDominator->eraseFromParent();
1471 conditional.
end(*
this);
1473 llvm::BasicBlock *notNullBB =
Builder.GetInsertBlock();
1476 llvm::PHINode *PHI =
Builder.CreatePHI(resultPtr->getType(), 2);
1477 PHI->addIncoming(resultPtr, notNullBB);
1478 PHI->addIncoming(llvm::Constant::getNullValue(resultPtr->getType()),
1500 if (DeleteFTy->getNumParams() == 2) {
1501 SizeTy = DeleteFTy->getParamType(1);
1503 Size = llvm::ConstantInt::get(
ConvertType(SizeTy),
1507 QualType ArgTy = DeleteFTy->getParamType(0);
1528 : Ptr(Ptr), OperatorDelete(OperatorDelete), ElementType(ElementType) {}
1541 OperatorDelete, ElementType);
1571 OperatorDelete, ElementType);
1612 : Ptr(Ptr), OperatorDelete(OperatorDelete), NumElements(NumElements),
1613 ElementType(ElementType), CookieSize(CookieSize) {}
1631 llvm::IntegerType *SizeTy
1632 = cast<llvm::IntegerType>(CGF.
ConvertType(
size_t));
1639 = llvm::ConstantInt::get(SizeTy, ElementTypeSize.getQuantity());
1641 Size = CGF.
Builder.CreateMul(Size, NumElements);
1644 if (!CookieSize.isZero()) {
1646 = llvm::ConstantInt::get(SizeTy, CookieSize.getQuantity());
1647 Size = CGF.
Builder.CreateAdd(Size, CookieSizeV);
1668 numElements, allocatedPtr, cookieSize);
1670 assert(allocatedPtr &&
"ReadArrayCookie didn't set allocated pointer");
1675 allocatedPtr, operatorDelete,
1676 numElements, elementType,
1681 assert(numElements &&
"no element count for a type with a destructor!");
1689 CGF.
Builder.CreateInBoundsGEP(arrayBegin, numElements,
"delete.end");
1714 Builder.CreateCondBr(IsNull, DeleteEnd, DeleteNotNull);
1725 GEP.push_back(Zero);
1729 =
getContext().getAsConstantArrayType(DeleteTy)) {
1731 DeleteTy = Arr->getElementType();
1734 GEP.push_back(Zero);
1755 if (
const auto *CE = dyn_cast<CastExpr>(E)) {
1756 if (!CE->getSubExpr()->isGLValue())
1761 if (
const auto *OVE = dyn_cast<OpaqueValueExpr>(E))
1764 if (
const auto *BO = dyn_cast<BinaryOperator>(E))
1765 if (BO->getOpcode() == BO_Comma)
1768 if (
const auto *ACO = dyn_cast<AbstractConditionalOperator>(E))
1774 if (isa<ArraySubscriptExpr>(E))
1777 if (
const auto *UO = dyn_cast<UnaryOperator>(E))
1778 if (UO->getOpcode() == UO_Deref)
1800 llvm::BasicBlock *BadTypeidBlock =
1805 CGF.
Builder.CreateCondBr(IsNull, BadTypeidBlock, EndBlock);
1844 return llvm::Constant::getNullValue(DestLTy);
1852 return llvm::UndefValue::get(DestLTy);
1871 bool isDynamicCastToVoid;
1879 isDynamicCastToVoid =
false;
1880 SrcRecordTy = SrcTy;
1884 assert(SrcRecordTy->
isRecordType() &&
"source type must be a record type!");
1889 bool ShouldNullCheckSrcValue =
1893 llvm::BasicBlock *CastNull =
nullptr;
1894 llvm::BasicBlock *CastNotNull =
nullptr;
1897 if (ShouldNullCheckSrcValue) {
1902 Builder.CreateCondBr(IsNull, CastNull, CastNotNull);
1907 if (isDynamicCastToVoid) {
1912 "destination type must be a record type!");
1914 DestTy, DestRecordTy, CastEnd);
1915 CastNotNull =
Builder.GetInsertBlock();
1918 if (ShouldNullCheckSrcValue) {
1927 if (ShouldNullCheckSrcValue) {
1928 llvm::PHINode *PHI =
Builder.CreatePHI(Value->getType(), 2);
1929 PHI->addIncoming(Value, CastNotNull);
1930 PHI->addIncoming(llvm::Constant::getNullValue(Value->getType()), CastNull);
1945 i != e; ++i, ++CurField) {
1948 if (CurField->hasCapturedVLAType()) {
1949 auto VAT = CurField->getCapturedVLAType();
1953 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
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
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
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 an array type, per C99 6.7.5.2 - Array Declarators.
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
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
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)
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)
C++ methods have some special rules and also have implicit parameters.
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)
void EmitCXXAggrConstructorCall(const CXXConstructorDecl *D, const ArrayType *ArrayTy, Address ArrayPtr, const CXXConstructExpr *E, bool ZeroInitialization=false)
EmitCXXAggrConstructorCall - Emit a loop to call a particular constructor for each of several members...
SourceLocation getExprLoc() const LLVM_READONLY
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
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>.
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.
static RequiredArgs commonEmitCXXMemberOrOperatorCall(CodeGenFunction &CGF, const CXXMethodDecl *MD, llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *CE, CallArgList &Args)
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)
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
Get the constructor that this expression will (ultimately) call.
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...
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
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.
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.
void EmitVTablePtrCheckForCall(const CXXRecordDecl *RD, llvm::Value *VTable, CFITypeCheckKind TCK, SourceLocation Loc)
EmitVTablePtrCheckForCall - Virtual method MD is being called via VTable.
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)
static RequiredArgs forPrototypePlus(const FunctionProtoType *prototype, unsigned additional, const FunctionDecl *FD)
Compute the arguments required by the given formal prototype, given that there may be some additional...
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.
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.