24#include "llvm/ADT/Sequence.h"
25#include "llvm/Support/TrailingObjects.h"
31struct MemberCallInfo {
45 "Trying to emit a member or operator call expr on a static method!");
60 unsigned prefixSize = args.size() - 1;
75 fpt->getNumParams() == 0 &&
76 "No CallExpr specified for function with non-zero number of arguments");
80 return {required, prefixSize};
109 auto [ calleePtr, adjustedThis] =
110 builder.createGetMethod(loc, memFnPtr, thisAddr.getPointer());
121 return emitCall(
cgm.getTypes().arrangeCXXMethodCall(argsList, fpt, required,
134 bool canUseVirtualCall = md->
isVirtual() && !hasQualifier;
138 if (canUseVirtualCall &&
142 assert(devirtualizedMethod);
158 devirtualizedMethod =
nullptr;
168 devirtualizedMethod =
nullptr;
184 if (
auto *oce = dyn_cast<CXXOperatorCallExpr>(ce)) {
185 if (oce->isAssignmentOp()) {
186 rtlArgs = &rtlArgStorage;
189 0, EvaluationOrder::ForceRightToLeft);
205 "emitCXXMemberOrOperatorMemberCallExpr: constructor call");
215 devirtualizedMethod ? devirtualizedMethod : md;
217 if (
const auto *dtor = dyn_cast<CXXDestructorDecl>(calleeDecl))
218 fInfo = &
cgm.getTypes().arrangeCXXStructorDeclaration(
221 fInfo = &
cgm.getTypes().arrangeCXXMethodDeclaration(calleeDecl);
223 cir::FuncType ty =
cgm.getTypes().getFunctionType(*fInfo);
234 bool useVirtualCall = canUseVirtualCall && !devirtualizedMethod;
236 if (
const auto *dtor = dyn_cast<CXXDestructorDecl>(calleeDecl)) {
238 "Destructor shouldn't have explicit parameters");
239 assert(
returnValue.isNull() &&
"Destructor shouldn't have return value");
240 if (useVirtualCall) {
248 if (!devirtualizedMethod) {
250 cgm.getAddrOfCXXStructor(globalDecl, fInfo, ty), globalDecl);
268 if (useVirtualCall) {
274 "emitCXXMemberOrOperatorMemberCallExpr: AppleKext");
284 cgm.getCXXABI().adjustThisArgumentForVirtualFunctionCall(
285 *
this, calleeDecl, thisPtr.
getAddress(), useVirtualCall);
299 "Trying to emit a member call expr on a static method!");
309 cgm.errorNYI(
"CUDA Device side kernel call");
320 *
this, md, thisPtr, implicitParam, implicitParamTy, ce, args, rtlArgs);
321 auto &fnInfo =
cgm.getTypes().arrangeCXXMethodCall(
322 args, fpt, callInfo.reqArgs, callInfo.prefixSize);
323 assert((ce ||
currSrcLoc) &&
"expected source location");
358 "emitNullBaseClassInitialization: base constant is not null");
367 assert(stores.size() == 1 &&
"Expected only one store");
369 "Expected store to begin at offset zero");
379 assert(!dest.
isIgnored() &&
"Must have a destination!");
426 bool forVirtualBase =
false;
427 bool delegating =
false;
439 forVirtualBase =
true;
464 unsigned minElements,
465 mlir::Value &numElements,
466 mlir::Value &sizeWithoutCookie) {
474 return sizeWithoutCookie;
491 llvm::APInt arraySizeMultiplier(sizeWidth, 1);
494 type = cat->getElementType();
495 arraySizeMultiplier *= cat->getSize();
499 llvm::APInt typeSizeMultiplier(sizeWidth, typeSize.
getQuantity());
500 typeSizeMultiplier *= arraySizeMultiplier;
503 llvm::APInt cookieSize(sizeWidth,
513 mlir::Attribute constNumElements =
516 if (constNumElements) {
518 auto numEltsAttr = mlir::cast<cir::IntAttr>(constNumElements);
519 const llvm::APInt &count = numEltsAttr.getValue();
521 [[maybe_unused]]
unsigned numElementsWidth = count.getBitWidth();
522 bool hasAnyOverflow =
false;
532 assert(!(numEltsAttr.isSigned() && count.isNegative()) &&
533 "Expected non-negative array size");
534 assert(numElementsWidth <= sizeWidth &&
535 "Expected a size_t array size constant");
538 llvm::APInt adjustedCount = count.zextOrTrunc(sizeWidth);
550 llvm::APInt allocationSize =
551 adjustedCount.umul_ov(typeSizeMultiplier, overflow);
552 hasAnyOverflow |= overflow;
555 if (cookieSize != 0) {
559 loc, allocationSize.zextOrTrunc(sizeWidth));
561 allocationSize = allocationSize.uadd_ov(cookieSize, overflow);
562 hasAnyOverflow |= overflow;
566 if (hasAnyOverflow) {
575 auto numElementsType = mlir::cast<cir::IntType>(numElements.getType());
576 unsigned numElementsWidth = numElementsType.getWidth();
585 (*e->
getArraySize())->getType()->isSignedIntegerOrEnumerationType();
600 mlir::Value hasOverflow;
605 if (numElementsWidth > sizeWidth) {
606 llvm::APInt threshold =
607 llvm::APInt::getOneBitSet(numElementsWidth, sizeWidth);
610 mlir::Value unsignedNumElements = numElements;
615 mlir::Value thresholdV =
618 loc, cir::CmpOpKind::ge, unsignedNumElements, thresholdV);
620 unsignedNumElements, mlir::cast<cir::IntType>(cgf.
sizeTy));
623 }
else if (isSigned) {
624 if (numElementsWidth < sizeWidth)
633 if (typeSizeMultiplier == 1)
635 loc, cir::CmpOpKind::lt, numElements,
640 numElements, mlir::cast<cir::IntType>(cgf.
sizeTy));
643 }
else if (numElementsWidth < sizeWidth) {
645 numElements, mlir::cast<cir::IntType>(cgf.
sizeTy));
648 assert(numElements.getType() == cgf.
sizeTy);
654 loc, llvm::APInt(sizeWidth, minElements));
656 numElements, minElementsV);
657 }
else if (numElementsWidth > sizeWidth) {
662 loc, llvm::APInt(sizeWidth, minElements));
679 if (typeSizeMultiplier != 1) {
681 auto mulOp = cir::MulOverflowOp::create(
689 hasOverflow = mulOp.getOverflow();
691 size = mulOp.getResult();
694 if (arraySizeMultiplier != 1) {
697 if (typeSize.
isOne()) {
698 assert(arraySizeMultiplier == typeSizeMultiplier);
710 assert(arraySizeMultiplier == 1);
714 if (cookieSize != 0) {
715 sizeWithoutCookie = size;
717 auto addOp = cir::AddOverflowOp::create(
725 hasOverflow = addOp.getOverflow();
727 size = addOp.getResult();
734 mlir::Value allOnes =
741 sizeWithoutCookie = size;
743 assert(sizeWithoutCookie &&
"didn't set sizeWithoutCookie?");
754 cir::CIRCallOpInterface callOrTryCall;
768 if (calleePtr->hasAttr(cir::CIRDialect::getNoBuiltinAttrName()))
769 callOrTryCall->setAttr(cir::CIRDialect::getBuiltinAttrName(),
770 mlir::UnitAttr::get(callOrTryCall->getContext()));
777 callOrTryCall.setMemoryEffectsAttr(
778 cir::MemoryEffectsAttr::inaccessibleOrErrnoMemOnly(
779 callOrTryCall->getContext(), cir::ModRefInfo::ModRef,
780 cir::ModRefInfo::Mod));
794 assert(op == OO_New || op == OO_Delete);
800 if (
const auto *funcDecl = dyn_cast<FunctionDecl>(
decl)) {
802 if (
sanOpts.has(SanitizerKind::AllocToken)) {
805 cgm.errorNYI(
"Alloc token sanitizer not yet supported!");
814 llvm_unreachable(
"predeclared global operator new/delete is missing");
818template <
typename Traits>
struct PlacementArg {
819 typename Traits::RValueTy argValue;
826template <
typename Traits>
827class CallDeleteDuringNew final
828 :
public EHScopeStack::Cleanup,
829 private llvm::TrailingObjects<CallDeleteDuringNew<Traits>,
830 PlacementArg<Traits>> {
832 llvm::TrailingObjects<CallDeleteDuringNew<Traits>, PlacementArg<Traits>>;
834 using TrailingObj::getTrailingObjects;
837 typedef typename Traits::ValueTy ValueTy;
839 typedef typename Traits::RValueTy RValueTy;
841 unsigned numPlacementArgs : 30;
843 unsigned passAlignmentToPlacementDelete : 1;
849 PlacementArg<Traits> *getPlacementArgs() {
return getTrailingObjects(); }
852 void setPlacementArg(
unsigned i, RValueTy argValue,
QualType argType) {
853 assert(i < numPlacementArgs &&
"index out of range");
854 getPlacementArgs()[i] = {argValue, argType};
857 static size_t getExtraSize(
size_t numPlacementArgs) {
858 return TrailingObj::template additionalSizeToAlloc<PlacementArg<Traits>>(
862 CallDeleteDuringNew(
size_t numPlacementArgs,
863 const FunctionDecl *operatorDelete, ValueTy ptr,
865 const ImplicitAllocationParameters &iap,
866 CharUnits allocAlign)
867 : numPlacementArgs(numPlacementArgs),
869 operatorDelete(operatorDelete), ptr(ptr), allocSize(allocSize),
870 allocAlign(allocAlign) {}
872 void emit(CIRGenFunction &cgf, Flags flags)
override {
873 const auto *fpt = operatorDelete->
getType()->
castAs<FunctionProtoType>();
874 CallArgList deleteArgs;
876 unsigned firstNonTypeArg = 0;
882 deleteArgs.add(Traits::get(cgf, ptr), fpt->getParamType(firstNonTypeArg));
885 UsualDeleteParams params;
886 if (numPlacementArgs) {
900 "should not call destroying delete in a new-expression");
904 deleteArgs.add(Traits::get(cgf, allocSize),
919 for (
unsigned i = 0; i != numPlacementArgs; ++i) {
920 auto arg = getPlacementArgs()[i];
921 deleteArgs.add(Traits::get(cgf,
arg.argValue),
arg.argType);
933 Address newPtr, mlir::Value allocSize,
941 struct DirectCleanupTraits {
942 typedef mlir::Value ValueTy;
948 typedef CallDeleteDuringNew<DirectCleanupTraits> DirectCleanup;
956 const CallArg &arg = newArgs[i + numNonPlacementArgs];
957 cleanup->setPlacementArg(
965 auto saveValue = [&](mlir::Value value) -> mlir::Value {
969 value.getLoc(),
"cond-cleanup.save");
974 mlir::Value savedNewPtr = saveValue(newPtr.
getPointer());
975 mlir::Value savedAllocSize = saveValue(allocSize);
977 struct ConditionalCleanupTraits {
978 typedef mlir::Value ValueTy;
979 typedef mlir::Value RValueTy;
981 while (cir::CastOp castOp = v.getDefiningOp<cir::CastOp>()) {
982 if (castOp.getKind() != cir::CastKind::address_space &&
983 castOp.getKind() != cir::CastKind::bitcast)
987 cir::AllocaOp alloca = v.getDefiningOp<cir::AllocaOp>();
989 alloca.getLoc(), alloca.getAllocaType(), alloca,
990 llvm::MaybeAlign(alloca.getAlignment())));
993 typedef CallDeleteDuringNew<ConditionalCleanupTraits> ConditionalCleanup;
996 ConditionalCleanup *cleanup =
1002 const CallArg &arg = newArgs[i + numNonPlacementArgs];
1003 cleanup->setPlacementArg(
1035 llvm_unreachable(
"bad evaluation kind");
1040 Address beginPtr, mlir::Value numElements,
1041 mlir::Value allocSizeWithoutCookie) {
1049 unsigned initListElements = 0;
1057 auto tryMemsetInitialization = [&]() ->
bool {
1058 mlir::Location loc = numElements.getLoc();
1062 if (!
cgm.getTypes().isZeroInitializable(elementType))
1069 auto remainingSize = allocSizeWithoutCookie;
1070 if (initListElements) {
1072 unsigned initializedSize =
1075 cir::ConstantOp initSizeOp =
1076 builder.getConstInt(loc, remainingSize.getType(), initializedSize);
1077 remainingSize = builder.createSub(loc, remainingSize, initSizeOp);
1083 builder.createMemSet(loc, voidPtr, builder.getConstInt(loc,
cgm.uInt8Ty, 0),
1088 const InitListExpr *ile = dyn_cast<InitListExpr>(init);
1092 const Expr *ignoreParen =
nullptr;
1095 cplie = dyn_cast<CXXParenListInitExpr>(ignoreParen);
1096 sl = dyn_cast<StringLiteral>(ignoreParen);
1097 ocee = dyn_cast<ObjCEncodeExpr>(ignoreParen);
1100 if (ile || cplie || sl || ocee) {
1113 const Expr *initExpr = ile ? ile->
getInit(0) : init;
1130 bool alreadyInitedAll =
false;
1131 auto constElts = numElements.getDefiningOp<cir::ConstantOp>();
1134 alreadyInitedAll = (constVal == initListElements);
1138 if (!alreadyInitedAll) {
1140 mlir::Value initListElementsOp = builder.getUnsignedInt(
1141 initLoc, initListElements,
1143 curPtr = curPtr.
withPointer(builder.createPtrStride(
1144 initLoc, curPtr.
getPointer(), initListElementsOp));
1146 bool ok = tryMemsetInitialization();
1148 assert(ok &&
"couldn't memset character type?");
1155 initListElements = initExprs.size();
1172 "arrayinit.endOfInit");
1174 beginPtr.
getPointer(), endOfInit, elementType,
1181 for (
const Expr *ie : initExprs) {
1182 mlir::Location loc =
getLoc(ie->getExprLoc());
1188 builder.createStore(loc, curPtr.
getPointer(), endOfInit);
1195 mlir::Value castOp = builder.createPtrBitcast(
1197 mlir::Value offsetOp = builder.getSignedInt(loc, 1, 32);
1198 mlir::Value dataPtr = builder.createPtrStride(loc, castOp, offsetOp);
1210 auto *subIle = dyn_cast<InitListExpr>(init);
1213 assert(subIle->getNumInits() == 0 &&
"explicit inits in array filler?");
1214 init = subIle->getArrayFiller();
1223 auto constOp = mlir::dyn_cast<cir::ConstantOp>(numElements.getDefiningOp());
1225 auto constIntAttr = mlir::dyn_cast<cir::IntAttr>(constOp.getValue());
1227 if (constIntAttr && constIntAttr.getUInt() <= initListElements)
1231 assert(init &&
"have trailing elements to initialize but no initializer");
1243 if (tryMemsetInitialization())
1255 mlir::Type initType =
convertType(cce->getType());
1257 if (initListElements) {
1262 auto constIntAttr = mlir::cast<cir::IntAttr>(constOp.getValue());
1263 uint64_t numRemainingElements =
1264 constIntAttr.getUInt() - initListElements;
1267 numElements.getType(), numRemainingElements);
1274 if (!mlir::isa<cir::ArrayType>(initType))
1275 initType = cir::ArrayType::get(initType, numRemainingElements);
1278 "emitNewArrayInitializer: numRemainingElements with "
1279 "non-constant count");
1287 cce->requiresZeroInitialization(), endOfInit);
1288 if (
getContext().getTargetInfo().emitVectorDeletingDtors(
1291 "emitNewArrayInitializer: emitVectorDeletingDtors");
1299 if (tryMemsetInitialization())
1310 "got wrong type of element to initialize");
1314 if (
auto *ile = dyn_cast<InitListExpr>(init)) {
1317 if (ile->
getNumInits() == 0 && tryMemsetInitialization())
1321 if (rtype->getDecl()->isStruct()) {
1323 unsigned numElements = 0;
1324 if (
auto *cxxrd = dyn_cast<CXXRecordDecl>(rd))
1325 numElements = cxxrd->getNumBases();
1327 if (!field->isUnnamedBitField())
1331 for (
unsigned i = 0, e = ile->
getNumInits(); i != e; ++i)
1334 if (ile->
getNumInits() == numElements && tryMemsetInitialization())
1345 "emitNewArrayInitializer: unsupported initializer");
1350 QualType elementType, mlir::Type elementTy,
1351 Address newPtr, mlir::Value numElements,
1352 mlir::Value allocSizeWithoutCookie) {
1356 allocSizeWithoutCookie);
1369 assert(!thisTy.
isNull());
1371 "Pointer/Object mixup");
1377 implicitParamTy, ce, args,
nullptr);
1378 assert((ce || dtor.
getDecl()) &&
"expected source location provider");
1379 return emitCall(
cgm.getTypes().arrangeCXXStructorDeclaration(dtor), callee,
1389 cgm.errorNYI(
expr->getExprLoc(),
1390 "emitCXXPseudoDestructorExpr: Objective-C lifetime is NYI");
1410 CallObjectDelete(mlir::Value ptr,
const FunctionDecl *operatorDelete,
1412 : ptr(ptr), operatorDelete(operatorDelete), elementType(elementType) {}
1455 if (rd->hasDefinition() && !rd->hasTrivialDestructor()) {
1456 dtor = rd->getDestructor();
1470 cgf.
ehStack.pushCleanup<CallObjectDelete>(
1476 false, ptr, elementType);
1497 cir::YieldOp thenYield;
1498 mlir::Value notNull = builder.createPtrIsNotNull(ptr.
getPointer());
1502 [&](mlir::OpBuilder &b, mlir::Location loc) {
1503 thenYield = builder.createYield(loc);
1508 mlir::OpBuilder::InsertionGuard guard(builder);
1509 builder.setInsertionPoint(thenYield);
1525 cgm.getASTContext().getTargetInfo().emitVectorDeletingDtors(
1526 cgm.getASTContext().getLangOpts())) {
1528 "emitCXXDeleteExpr: emitVectorDeletingDtors");
1533 cir::FuncOp operatorDeleteFn =
cgm.getAddrOfFunction(operatorDelete);
1535 mlir::FlatSymbolRefAttr::get(operatorDeleteFn.getSymNameAttr());
1537 std::optional<uint64_t> align;
1540 CharUnits elementSize =
cgm.getASTContext().getTypeSizeInChars(deleteTy);
1545 cir::UsualDeleteParamsAttr deleteParams;
1548 deleteParams = cir::UsualDeleteParamsAttr::get(
1549 builder.getContext(), udp.
Size, align,
1553 uint64_t elementAlign =
cgm.getASTContext()
1554 .getPreferredTypeAlignInChars(deleteTy)
1557 mlir::FlatSymbolRefAttr elementDtor;
1558 bool hasThrowingDtor =
false;
1560 if (rd->hasDefinition() && !rd->hasTrivialDestructor()) {
1563 hasThrowingDtor =
true;
1564 cir::FuncOp dtorFn =
1566 elementDtor = mlir::FlatSymbolRefAttr::get(builder.getContext(),
1567 dtorFn.getSymNameAttr());
1571 cir::DeleteArrayOp::create(builder, ptr.
getPointer().getLoc(),
1573 elementDtor, hasThrowingDtor,
1574 builder.getI64IntegerAttr(elementAlign));
1588 unsigned minElements = 0;
1591 const InitListExpr *ile = dyn_cast<InitListExpr>(init);
1600 }
else if (ile || cplie) {
1605 mlir::Value numElements =
nullptr;
1606 mlir::Value allocSizeWithoutCookie =
nullptr;
1608 *
this, e, minElements, numElements, allocSizeWithoutCookie);
1614 if (allocator->isReservedGlobalPlacementOperator()) {
1634 "emitCXXNewExpr: reserved placement new with delete");
1639 unsigned paramsToSkip = 0;
1646 if (allocSize != allocSizeWithoutCookie) {
1648 allocAlign = std::max(allocAlign, cookieAlign);
1655 constexpr unsigned indexOfAlignArg = 1;
1661 alignValType = allocatorType->
getParamType(indexOfAlignArg);
1662 cir::ConstantOp align = builder.getAlignment(
1683 allocator->isReplaceableGlobalAllocationFunction()) {
1684 const TargetInfo &target =
cgm.getASTContext().getTargetInfo();
1685 unsigned allocatorAlign = llvm::bit_floor(std::min<uint64_t>(
1687 allocationAlign = std::max(
1688 allocationAlign,
getContext().toCharUnitsFromBits(allocatorAlign));
1691 mlir::Value allocPtr = rv.
getValue();
1693 allocPtr, mlir::cast<cir::PointerType>(allocPtr.getType()).getPointee(),
1709 bool useNewDeleteCleanup =
1713 mlir::Type elementTy;
1733 mlir::Operation *cleanupDominator =
nullptr;
1734 if (useNewDeleteCleanup) {
1738 operatorDeleteCleanup =
ehStack.stable_begin();
1747 if (allocSize != allocSizeWithoutCookie) {
1749 allocation =
cgm.getCXXABI().initializeArrayCookie(
1750 *
this, allocation, numElements, e, allocType);
1754 allocation, elementTy);
1766 if (
cgm.getCodeGenOpts().StrictVTablePointers &&
1767 allocator->isReservedGlobalPlacementOperator())
1769 "emitCXXNewExpr: strict vtable pointers");
1774 conditional->beginEvaluation();
1776 allocSizeWithoutCookie);
1778 conditional->endEvaluation();
1782 if (useNewDeleteCleanup) {
1784 cleanupDominator->erase();
1785 cir::LoadOp loadResult =
1787 result = result.
withPointer(loadResult.getResult());
1791 cir::IfOp nullCheckOp;
1798 mlir::Value isNotNull = builder.createPtrIsNotNull(allocation.
getPointer());
1805 [&](mlir::OpBuilder &, mlir::Location loc) {
1807 builder.createYield(loc);
1813 mlir::Value resultValue = result.
getPointer();
1816 mlir::Type resultTy = resultValue.getType();
1821 mlir::Value trueVal;
1822 if (useNewDeleteCleanup) {
1828 if (trueVal.getType() != resultTy)
1829 trueVal = builder.createBitcast(trueVal, resultTy);
1830 mlir::Value nullPtr =
1834 nullCheckOp.getCondition(), trueVal, nullPtr);
1841 mlir::Value ptr,
QualType deleteTy) {
1848 auto paramTypeIter = deleteFTy->param_type_begin();
1853 "emitDeleteCall: type aware delete");
1857 std::advance(paramTypeIter, 1);
1858 mlir::Value deletePtr =
1859 builder.createBitcast(ptr.getLoc(), ptr,
convertType(argTy));
1865 std::advance(paramTypeIter, 1);
1873 QualType sizeType = *paramTypeIter;
1874 std::advance(paramTypeIter, 1);
1876 assert(mlir::isa<cir::IntType>(
convertType(sizeType)) &&
1877 "expected cir::IntType");
1878 cir::ConstantOp size =
1887 QualType alignValType = *paramTypeIter++;
1891 cir::ConstantOp align = builder.getAlignment(
1896 assert(paramTypeIter == deleteFTy->param_type_end() &&
1897 "unknown parameter to usual delete function");
1904 mlir::Location loc,
QualType destTy) {
1906 assert(mlir::isa<cir::PointerType>(destCIRTy) &&
1907 "result of dynamic_cast should be a ptr");
1910 mlir::Region *currentRegion = cgf.
getBuilder().getBlock()->getParent();
1917 cgf.
getBuilder().createBlock(currentRegion, currentRegion->end());
1927 cgm.emitExplicitCastExprType(dce,
this);
1939 if (isDynCastToVoid) {
1946 srcRecordTy = srcTy;
1950 assert(srcRecordTy->
isRecordType() &&
"source type must be a record type!");
1956 auto destCirTy = mlir::cast<cir::PointerType>(
convertType(destTy));
1957 return cgm.getCXXABI().emitDynamicCast(*
this, loc, srcRecordTy, destRecordTy,
1958 destCirTy, isRefCast, thisAddr);
1962 bool hasNullCheck) {
1973 mlir::Value isThisNull =
1979 false, [&](mlir::OpBuilder &, mlir::Location loc) {
1980 cgf.cgm.getCXXABI().emitBadTypeidCall(cgf, loc);
2006 return cgm.getCXXABI().emitTypeid(*
this, ty, thisPtr, resultType);
2015 auto typeInfoGlobal =
2017 auto getTypeInfo = cir::GetGlobalOp::create(
2018 builder, loc, builder.getPointerTo(typeInfoGlobal.getSymType()),
2019 typeInfoGlobal.getSymName());
2023 return builder.createBitcast(getTypeInfo, resultType);
static bool emit(llvm::SmallVectorImpl< std::byte > &Code, const T &Val)
Helper to write bytecode and bail out if 32-bit offsets become invalid.
static CXXRecordDecl * getCXXRecord(const Expr *E)
static void emitNewInitializer(CIRGenFunction &cgf, const CXXNewExpr *e, QualType elementType, mlir::Type elementTy, Address newPtr, mlir::Value numElements, mlir::Value allocSizeWithoutCookie)
static void emitObjectDelete(CIRGenFunction &cgf, const CXXDeleteExpr *de, Address ptr, QualType elementType)
Emit the code for deleting a single object.
static void emitNullBaseClassInitialization(CIRGenFunction &cgf, Address destPtr, const CXXRecordDecl *base)
static void enterNewDeleteCleanup(CIRGenFunction &cgf, const CXXNewExpr *e, Address newPtr, mlir::Value allocSize, CharUnits allocAlign, const CallArgList &newArgs)
Enter a cleanup to call 'operator delete' if the initializer in a new-expression throws.
static Address emitCXXTypeidOperand(CIRGenFunction &cgf, const Expr *e, bool hasNullCheck)
static mlir::Value emitCXXNewAllocSize(CIRGenFunction &cgf, const CXXNewExpr *e, unsigned minElements, mlir::Value &numElements, mlir::Value &sizeWithoutCookie)
static void emitDestroyingObjectDelete(CIRGenFunction &cgf, const CXXDeleteExpr *de, Address ptr, QualType elementType)
Emit the code for deleting a single object via a destroying operator delete.
static void storeAnyExprIntoOneUnit(CIRGenFunction &cgf, const Expr *init, QualType allocType, Address newPtr, AggValueSlot::Overlap_t mayOverlap)
static CharUnits calculateCookiePadding(CIRGenFunction &cgf, const CXXNewExpr *e)
static mlir::Value emitDynamicCastToNull(CIRGenFunction &cgf, mlir::Location loc, QualType destTy)
static MemberCallInfo commonBuildCXXMemberOrOperatorCall(CIRGenFunction &cgf, const CXXMethodDecl *md, mlir::Value thisPtr, mlir::Value implicitParam, QualType implicitParamTy, const CallExpr *ce, CallArgList &args, CallArgList *rtlArgs)
static RValue emitNewDeleteCall(CIRGenFunction &cgf, const FunctionDecl *calleeDecl, const FunctionProtoType *calleeType, const CallArgList &args)
Emit a call to an operator new or operator delete function, as implicitly created by new-expressions ...
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines an enumeration for C++ overloaded operators.
static QualType getPointeeType(const MemRegion *R)
cir::ConstantOp getConstant(mlir::Location loc, mlir::TypedAttr attr)
mlir::Value createOr(mlir::Location loc, mlir::Value lhs, mlir::Value rhs)
mlir::Value createPtrIsNull(mlir::Value ptr)
cir::ConstantOp getNullPtr(mlir::Type ty, mlir::Location loc)
mlir::Value createIntCast(mlir::Value src, mlir::Type newTy)
cir::CmpOp createCompare(mlir::Location loc, cir::CmpOpKind kind, mlir::Value lhs, mlir::Value rhs)
mlir::Value createSelect(mlir::Location loc, mlir::Value condition, mlir::Value trueValue, mlir::Value falseValue)
mlir::Value createMul(mlir::Location loc, mlir::Value lhs, mlir::Value rhs, OverflowBehavior ob=OverflowBehavior::None)
cir::ConstantOp getAlignment(mlir::Location loc, mlir::Type t, clang::CharUnits alignment)
llvm::Align getABITypeAlign(mlir::Type ty) const
llvm::TypeSize getTypeSizeInBits(mlir::Type ty) const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
DeclarationNameTable DeclarationNames
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
static uint64_t getConstantArrayElementCount(const ConstantArrayType *CA)
Return number of (potentially nested) constant array elements.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
Represents an array type, per C99 6.7.5.2 - Array Declarators.
A builtin binary operation expression such as "x + y" or "x <= y".
Address withPointer(mlir::Value newPtr) const
Return address with different pointer, but same element type and alignment.
mlir::Value getPointer() const
mlir::Type getElementType() const
Address withElementType(CIRGenBuilderTy &builder, mlir::Type ElemTy) const
Return address with different element type, a bitcast pointer, and the same alignment.
clang::CharUnits getAlignment() const
Address withAlignment(clang::CharUnits newAlignment) const
Return address with different alignment, but same pointer and element type.
mlir::Type getType() const
mlir::Value emitRawPointer() const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
IsZeroed_t isZeroed() const
static AggValueSlot forAddr(Address addr, clang::Qualifiers quals, IsDestructed_t isDestructed, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed)
Address getAddress() const
cir::IntType getSIntNTy(int n)
cir::StoreOp createStore(mlir::Location loc, mlir::Value val, Address dst, bool isVolatile=false, bool isNontemporal=false, mlir::IntegerAttr align={}, cir::SyncScopeKindAttr scope={}, cir::MemOrderAttr order={})
cir::LoadOp createAlignedLoad(mlir::Location loc, mlir::Type ty, mlir::Value ptr, llvm::MaybeAlign align)
bool isNullValue(mlir::Attribute attr) const
cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal)
cir::IntType getUIntNTy(int n)
virtual void emitVirtualObjectDelete(CIRGenFunction &cgf, const CXXDeleteExpr *de, Address ptr, QualType elementType, const CXXDestructorDecl *dtor)=0
virtual const clang::CXXRecordDecl * getThisArgumentTypeForMethod(const clang::CXXMethodDecl *md)
Get the type of the implicit "this" parameter used by a method.
virtual bool shouldTypeidBeNullChecked(QualType srcTy)=0
virtual void emitBadCastCall(CIRGenFunction &cgf, mlir::Location loc)=0
virtual CharUnits getArrayCookieSize(const CXXNewExpr *e)
Returns the extra size required in order to store the array cookie for the given new-expression.
static CIRGenCallee forDirect(mlir::Operation *funcPtr, const CIRGenCalleeInfo &abstractInfo=CIRGenCalleeInfo())
static CIRGenCallee forVirtual(const clang::CallExpr *ce, clang::GlobalDecl md, Address addr, cir::FuncType fTy)
An abstract representation of regular/ObjC call/message targets.
An object to manage conditionally-evaluated expressions.
mlir::Type convertType(clang::QualType t)
static cir::TypeEvaluationKind getEvaluationKind(clang::QualType type)
Return the cir::TypeEvaluationKind of QualType type.
clang::GlobalDecl curGD
The GlobalDecl for the current function being compiled or the global variable currently being initial...
CIRGenTypes & getTypes() const
Address emitPointerWithAlignment(const clang::Expr *expr, LValueBaseInfo *baseInfo=nullptr)
Given an expression with a pointer type, emit the value and compute our best estimate of the alignmen...
void initFullExprCleanup()
Set up the last cleanup that was pushed as a conditional full-expression cleanup.
const clang::LangOptions & getLangOpts() const
cir::AllocaOp createTempAlloca(mlir::Type ty, mlir::Location loc, const Twine &name="tmp", mlir::Value arraySize=nullptr, bool insertIntoFnEntryBlock=false)
This creates an alloca and inserts it into the entry block if ArraySize is nullptr,...
RValue emitCXXMemberPointerCallExpr(const CXXMemberCallExpr *ce, ReturnValueSlot returnValue)
bool isInConditionalBranch() const
void emitDeleteCall(const FunctionDecl *deleteFD, mlir::Value ptr, QualType deleteTy)
LValue emitLValue(const clang::Expr *e)
Emit code to compute a designator that specifies the location of the expression.
void pushIrregularPartialArrayCleanup(mlir::Value arrayBegin, Address arrayEndPointer, QualType elementType, CharUnits elementAlign, Destroyer *destroyer)
Push an EH cleanup to destroy already-constructed elements of the given array.
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
void emitCallArgs(CallArgList &args, PrototypeWrapper prototype, llvm::iterator_range< clang::CallExpr::const_arg_iterator > argRange, AbstractCallee callee=AbstractCallee(), unsigned paramsToSkip=0, EvaluationOrder order=EvaluationOrder::Default)
RValue emitCXXMemberOrOperatorCall(const clang::CXXMethodDecl *md, const CIRGenCallee &callee, ReturnValueSlot returnValue, mlir::Value thisPtr, mlir::Value implicitParam, clang::QualType implicitParamTy, const clang::CallExpr *ce, CallArgList *rtlArgs)
void emitNullInitialization(mlir::Location loc, Address destPtr, QualType ty)
void emitScalarInit(const clang::Expr *init, LValue lvalue, bool capturedByInit=false)
RValue emitCUDAKernelCallExpr(const CUDAKernelCallExpr *expr, ReturnValueSlot returnValue)
EHScopeStack ehStack
Tracks function scope overall cleanup handling.
void emitNewArrayInitializer(const CXXNewExpr *e, QualType elementType, mlir::Type elementTy, Address beginPtr, mlir::Value numElements, mlir::Value allocSizeWithoutCookie)
clang::SanitizerSet sanOpts
Sanitizers enabled for this function.
static int64_t getZExtIntValueFromConstOp(mlir::Value val)
Get zero-extended integer from a mlir::Value that is an int constant or a constant op.
mlir::Value emitCXXTypeidExpr(const CXXTypeidExpr *e)
mlir::Type convertTypeForMem(QualType t)
void emitCXXConstructExpr(const clang::CXXConstructExpr *e, AggValueSlot dest)
mlir::Value emitCXXNewExpr(const CXXNewExpr *e)
Address returnValue
The temporary alloca to hold the return value.
void emitCXXConstructorCall(const clang::CXXConstructorDecl *d, clang::CXXCtorType type, bool forVirtualBase, bool delegating, AggValueSlot thisAVS, const clang::CXXConstructExpr *e)
const CallExpr * mustTailCall
void deactivateCleanupBlock(EHScopeStack::stable_iterator cleanup, mlir::Operation *dominatingIP)
Deactivates the given cleanup block.
mlir::Value emitScalarExpr(const clang::Expr *e, bool ignoreResultAssign=false)
Emit the computation of the specified expression of scalar type.
CIRGenBuilderTy & getBuilder()
Destroyer * getDestroyer(clang::QualType::DestructionKind kind)
void popCleanupBlock(bool forDeactivation=false)
Pop a cleanup block from the stack.
std::optional< SourceRange > currSrcLoc
Use to track source locations across nested visitor traversals.
void emitComplexExprIntoLValue(const Expr *e, LValue dest, bool isInit)
RValue emitCall(const CIRGenFunctionInfo &funcInfo, const CIRGenCallee &callee, ReturnValueSlot returnValue, const CallArgList &args, cir::CIRCallOpInterface *callOp, bool isMustTail, SourceRange clangLoc)
LValue makeAddrLValue(Address addr, QualType ty, AlignmentSource source=AlignmentSource::Type)
void emitCXXDestructorCall(const CXXDestructorDecl *dd, CXXDtorType type, bool forVirtualBase, bool delegating, Address thisAddr, QualType thisTy)
RValue emitNewOrDeleteBuiltinCall(const FunctionProtoType *type, const CallExpr *callExpr, OverloadedOperatorKind op)
void emitCXXAggrConstructorCall(const CXXConstructorDecl *ctor, const clang::ArrayType *arrayType, Address arrayBegin, const CXXConstructExpr *e, bool newPointerIsChecked, bool zeroInitialize=false)
Emit a loop to call a particular constructor for each of several members of an array.
clang::ASTContext & getContext() const
RValue emitCXXMemberOrOperatorMemberCallExpr(const clang::CallExpr *ce, const clang::CXXMethodDecl *md, ReturnValueSlot returnValue, bool hasQualifier, clang::NestedNameSpecifier qualifier, bool isArrow, const clang::Expr *base)
void emitCXXDeleteExpr(const CXXDeleteExpr *e)
RValue emitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *e, const CXXMethodDecl *md, ReturnValueSlot returnValue)
void emitIgnoredExpr(const clang::Expr *e)
Emit code to compute the specified expression, ignoring the result.
Address createMemTemp(QualType t, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr, mlir::OpBuilder::InsertPoint ip={})
Create a temporary memory object of the given type, with appropriate alignmen and cast it to the defa...
mlir::Value emitDynamicCast(Address thisAddr, const CXXDynamicCastExpr *dce)
void emitAggExpr(const clang::Expr *e, AggValueSlot slot)
RValue emitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *expr)
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
mlir::TypedAttr emitNullConstantForBase(const CXXRecordDecl *record)
Return a null constant appropriate for zero-initializing a base class with the given type.
const cir::CIRDataLayout & getDataLayout() const
cir::FuncOp getAddrOfFunction(clang::GlobalDecl gd, mlir::Type funcType=nullptr, bool forVTable=false, bool dontDefer=false, ForDefinition_t isForDefinition=NotForDefinition)
Return the address of the given function.
const clang::CodeGenOptions & getCodeGenOpts() const
CIRGenCXXABI & getCXXABI() const
const CIRGenFunctionInfo & arrangeFreeFunctionCall(const CallArgList &args, const FunctionType *fnType)
clang::CanQualType deriveThisType(const clang::CXXRecordDecl *rd, const clang::CXXMethodDecl *md)
Derives the 'this' type for CIRGen purposes, i.e.
void addFrom(const CallArgList &other)
Add all the arguments from another CallArgList to this one.
void add(RValue rvalue, clang::QualType type)
mlir::Attribute tryEmitAbstract(const Expr *e, QualType destType)
Information for lazily generating a cleanup.
A saved depth on the scope stack.
T * pushCleanupWithExtra(CleanupKind kind, size_t n, As... a)
Push a cleanup with non-constant storage requirements on the stack.
AlignmentSource getAlignmentSource() const
Address getAddress() const
mlir::Value getPointer() const
void setAddress(Address address)
This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(mlir::Value v)
static RValue getAggregate(Address addr, bool isVolatile=false)
Convert an Address to an RValue.
mlir::Value getValue() const
Return the value of this scalar value.
A class for recording the number of arguments that a function signature requires.
static RequiredArgs getFromProtoWithExtraSlots(const clang::FunctionProtoType *prototype, unsigned additional)
Compute the arguments required by the given formal prototype, given that there may be some additional...
Contains the address where the return value of a function can be stored, and whether the address is v...
Represents a call to a CUDA kernel function.
Represents a call to a C++ constructor.
bool isElidable() const
Whether this construction is elidable.
Expr * getArg(unsigned Arg)
Return the specified argument.
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
CXXConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Represents a C++ constructor within a class.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
Represents a delete expression for memory deallocation and destructor calls, e.g.
FunctionDecl * getOperatorDelete() const
QualType getDestroyedType() const
Retrieve the type being destroyed.
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
bool isAlwaysNull() const
isAlwaysNull - Return whether the result of the dynamic_cast is proven to always be null.
Represents a call to a member function that may be written either with member call syntax (e....
SourceLocation getExprLoc() const LLVM_READONLY
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
llvm::iterator_range< arg_iterator > placement_arguments()
QualType getAllocatedType() const
unsigned getNumImplicitArgs() const
std::optional< Expr * > getArraySize()
This might return std::nullopt even if isArray() returns true, since there might not be an array size...
ImplicitAllocationParameters implicitAllocationParameters() const
Provides the full set of information about expected implicit parameters in this call.
bool hasInitializer() const
Whether this new-expression has any initializer at all.
bool shouldNullCheckAllocation() const
True if the allocation result needs to be null-checked.
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function.
FunctionDecl * getOperatorDelete() const
unsigned getNumPlacementArgs() const
SourceRange getSourceRange() const
FunctionDecl * getOperatorNew() const
Expr * getInitializer()
The initializer of this new-expression.
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
MutableArrayRef< Expr * > getInitExprs()
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
bool isTypeOperand() const
QualType getTypeOperand(const ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
Expr * getExprOperand() const
SourceRange getSourceRange() const LLVM_READONLY
bool isMostDerived(const ASTContext &Context) const
Best-effort check if the expression operand refers to a most derived object.
bool isPotentiallyEvaluated() const
Determine whether this typeid has a type operand which is potentially evaluated, per C++11 [expr....
bool hasNullCheck() const
Whether this is of a form like "typeid(*ptr)" that can throw a std::bad_typeid if a pointer is a null...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
This is an opaque type for sizes expressed in character units.
CharUnits alignmentAtOffset(CharUnits offset) const
Given that this is a non-zero alignment value, what is the alignment at the given offset?
QuantityType getQuantity() const
Get the raw integer representation of this quantity.
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
bool isOne() const
Test whether the quantity equals one.
static CharUnits fromQuantity(QuantityType Quantity)
Construct a CharUnits quantity from a raw integer type.
static CharUnits Zero()
Construct a CharUnits quantity of zero.
Represents the canonical version of C arrays with a specified constant size.
The results of name lookup within a DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
The name of a declaration.
bool isAnyOperatorNew() const
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
This represents one expression.
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
Expr * IgnoreParenBaseCasts() LLVM_READONLY
Skip past any parentheses and derived-to-base casts until reaching a fixed point.
bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const
Determine whether the result of this expression is a temporary object of the given class type.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Represents a member of a struct/union/class.
Represents a function declaration or definition.
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
QualType getReturnType() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool isReplaceableGlobalAllocationFunction(UnsignedOrNone *AlignmentParam=nullptr, bool *IsNothrow=nullptr) const
Determines whether this function is one of the replaceable global allocation functions:
UsualDeleteParams getUsualDeleteParams() const
bool isReservedGlobalPlacementOperator() const
Determines whether this operator new or delete is one of the reserved global placement operators: voi...
bool isDefaulted() const
Whether this function is defaulted.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Represents a prototype with parameter type info, e.g.
unsigned getNumParams() const
QualType getParamType(unsigned i) const
CanThrowResult canThrow() const
Determine whether this function type has a non-throwing exception specification.
GlobalDecl - represents a global declaration.
const Decl * getDecl() const
Represents an implicitly-generated value initialization of an object of a given type.
Describes an C or C++ initializer list.
bool isStringLiteralInit() const
Is this an initializer for an array of characters, initialized by a string literal or an @encode?
unsigned getNumInits() const
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
const Expr * getInit(unsigned Init) const
ArrayRef< Expr * > inits() const
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getPointeeType() const
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
ObjCEncodeExpr, used for @encode in Objective-C.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getCanonicalType() const
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
bool hasStrongOrWeakObjCLifetime() const
Represents a struct/union/class.
field_range fields() const
RecordDecl * getDefinitionOrSelf() const
Base for LValueReferenceType and RValueReferenceType.
A trivial tuple used to represent a source range.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Exposes information about the current target.
unsigned getNewAlign() const
Return the largest alignment for which a suitably-sized allocation with 'operator new(size_t)' is gua...
SourceLocation getBeginLoc() const LLVM_READONLY
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isConstantArrayType() const
bool isVoidPointerType() const
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
@ EHCleanup
Denotes a cleanup that should run when a scope is exited using exceptional control flow (a throw stat...
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
const AstTypeMatcher< TagType > tagType
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.
Top level wrappers for InstallAPI frontend operations.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
CXXCtorType
C++ constructor types.
@ Ctor_Base
Base object ctor.
@ Ctor_Complete
Complete object ctor.
bool isa(CodeGen::Address addr)
AlignedAllocationMode alignedAllocationModeFromBool(bool IsAligned)
bool isAlignedAllocation(AlignedAllocationMode Mode)
@ Dtor_Complete
Complete object dtor.
bool isTypeAwareAllocation(TypeAwareAllocationMode Mode)
U cast(CodeGen::Address addr)
__DEVICE__ _Tp arg(const std::complex< _Tp > &__c)
static bool objCLifetime()
static bool addressSpace()
static bool devirtualizeDestructor()
static bool aggValueSlotGC()
static bool deleteArray()
static bool emitTypeCheck()
static bool typeAwareAllocation()
static bool emitNullCheckForDeleteCalls()
static bool generateDebugInfo()
Scope that deactivates all enclosed deferred cleanups on exit.
clang::CharUnits getPointerAlign() const
clang::CharUnits getSizeAlign() const
The parameters to pass to a usual operator delete.
TypeAwareAllocationMode TypeAwareDelete
AlignedAllocationMode Alignment