36class CopyingValueRepresentation {
38 explicit CopyingValueRepresentation(CIRGenFunction &cgf)
39 : cgf(cgf), oldSanOpts(cgf.sanOpts) {
40 cgf.sanOpts.set(SanitizerKind::Bool,
false);
41 cgf.sanOpts.set(SanitizerKind::Enum,
false);
43 ~CopyingValueRepresentation() { cgf.sanOpts = oldSanOpts; }
47 SanitizerSet oldSanOpts;
50class FieldMemcpyizer {
52 FieldMemcpyizer(CIRGenFunction &cgf,
const CXXRecordDecl *classDecl,
53 SourceLocation methodLoc,
const VarDecl *srcRec)
54 : cgf(cgf), classDecl(classDecl), methodLoc(methodLoc), srcRec(srcRec),
55 recLayout(cgf.getContext().getASTRecordLayout(classDecl)),
57 lastFieldOffset(0), lastAddedFieldIndex(0) {}
59 bool isMemcpyableField(FieldDecl *f)
const {
61 if (cgf.getContext().getLangOpts().SanitizeAddressFieldPadding)
71 void addMemcpyableField(FieldDecl *f) {
82 CharUnits getMemcpySize(
uint64_t firstByteOffset)
const {
83 ASTContext &astContext = cgf.getContext();
84 unsigned lastFieldSize =
85 lastField->isBitField()
86 ? lastField->getBitWidthValue()
90 uint64_t memcpySizeBits = lastFieldOffset + lastFieldSize -
102 if (firstField->isBitField()) {
103 const CIRGenRecordLayout &rl =
104 cgf.getTypes().getCIRGenRecordLayout(firstField->getParent());
108 firstByteOffset = cgf.getContext().toBits(bfInfo.
storageOffset);
110 firstByteOffset = firstFieldOffset;
113 CharUnits memcpySize = getMemcpySize(firstByteOffset);
114 CanQualType recordTy = cgf.getContext().getCanonicalTagType(classDecl);
115 Address thisPtr = cgf.loadCXXThisAddress();
116 LValue destLv = cgf.makeAddrLValue(thisPtr, recordTy);
117 LValue dest = cgf.emitLValueForFieldInitialization(destLv, firstField,
118 firstField->getName());
119 cir::LoadOp srcPtr = cgf.getBuilder().createLoad(
120 cgf.getLoc(methodLoc), cgf.getAddrOfLocalVar(srcRec));
121 LValue srcLv = cgf.makeNaturalAlignAddrLValue(srcPtr, recordTy);
122 LValue src = cgf.emitLValueForFieldInitialization(srcLv, firstField,
123 firstField->getName());
125 emitMemcpyIR(dest.isBitField() ? dest.getBitFieldAddress()
127 src.isBitField() ? src.getBitFieldAddress() : src.getAddress(),
132 void reset() { firstField =
nullptr; }
136 const CXXRecordDecl *classDecl;
137 SourceLocation methodLoc;
140 void emitMemcpyIR(Address destPtr, Address srcPtr, CharUnits size) {
141 mlir::Location loc = cgf.getLoc(methodLoc);
142 CIRGenBuilderTy &builder = cgf.getBuilder();
151 void addInitialField(FieldDecl *f) {
154 firstFieldOffset = recLayout.getFieldOffset(f->
getFieldIndex());
155 lastFieldOffset = firstFieldOffset;
159 void addNextField(FieldDecl *f) {
165 "Cannot aggregate fields out of order.");
172 if (fOffset < firstFieldOffset) {
174 firstFieldOffset = fOffset;
175 }
else if (fOffset >= lastFieldOffset) {
177 lastFieldOffset = fOffset;
181 const VarDecl *srcRec;
182 const ASTRecordLayout &recLayout;
183 FieldDecl *firstField;
184 FieldDecl *lastField;
185 uint64_t firstFieldOffset, lastFieldOffset;
186 unsigned lastAddedFieldIndex;
189class AssignmentMemcpyizer :
public FieldMemcpyizer {
192 FieldDecl *getMemcpyableField(Stmt *s) {
193 if (!assignmentsMemcpyable)
195 if (
auto *bo = dyn_cast<BinaryOperator>(s)) {
197 if (bo->getOpcode() != BO_Assign)
199 auto *me = dyn_cast<MemberExpr>(bo->getLHS());
202 auto *field = dyn_cast<FieldDecl>(me->getMemberDecl());
203 if (!field || !isMemcpyableField(field))
205 Stmt *rhs = bo->getRHS();
206 if (
auto *ec = dyn_cast<ImplicitCastExpr>(rhs))
207 rhs = ec->getSubExpr();
210 if (
auto *me2 = dyn_cast<MemberExpr>(rhs)) {
211 if (me2->getMemberDecl() == field)
218 }
else if (
auto *ce = dyn_cast<CallExpr>(s)) {
221 auto *fd = dyn_cast<FunctionDecl>(ce->getCalleeDecl());
222 if (!fd || fd->getBuiltinID() != Builtin::BI__builtin_memcpy)
224 Expr *dstPtr = ce->getArg(0);
225 if (
auto *dc = dyn_cast<ImplicitCastExpr>(dstPtr))
226 dstPtr = dc->getSubExpr();
227 auto *duo = dyn_cast<UnaryOperator>(dstPtr);
228 if (!duo || duo->getOpcode() != UO_AddrOf)
230 auto *me = dyn_cast<MemberExpr>(duo->getSubExpr());
233 auto *field = dyn_cast<FieldDecl>(me->getMemberDecl());
234 if (!field || !isMemcpyableField(field))
236 Expr *srcPtr = ce->getArg(1);
237 if (
auto *sc = dyn_cast<ImplicitCastExpr>(srcPtr))
238 srcPtr = sc->getSubExpr();
239 auto *suo = dyn_cast<UnaryOperator>(srcPtr);
240 if (!suo || suo->getOpcode() != UO_AddrOf)
242 auto *me2 = dyn_cast<MemberExpr>(suo->getSubExpr());
243 if (!me2 || field != dyn_cast<FieldDecl>(me2->getMemberDecl()))
251 const bool assignmentsMemcpyable;
252 SmallVector<Stmt *, 16> aggregatedStmts;
255 AssignmentMemcpyizer(CIRGenFunction &cgf,
const CXXMethodDecl *ad,
256 FunctionArgList &args)
257 : FieldMemcpyizer(cgf, ad->getParent(), ad->getLocation(),
258 args[args.size() - 1]),
259 assignmentsMemcpyable(cgf.getLangOpts().getGC() == LangOptions::NonGC) {
260 assert(args.size() == 2);
263 void emitAssignment(Stmt *s) {
264 FieldDecl *f = getMemcpyableField(s);
266 addMemcpyableField(f);
267 aggregatedStmts.push_back(s);
269 emitAggregatedStmts();
275 void emitAggregatedStmts() {
276 if (aggregatedStmts.size() <= 1) {
277 if (!aggregatedStmts.empty()) {
278 CopyingValueRepresentation cvr(cgf);
279 if (cgf.
emitStmt(aggregatedStmts[0],
true).failed())
287 aggregatedStmts.clear();
290 void finish() { emitAggregatedStmts(); }
352 for (
const auto *nd : indirectField->
chain()) {
367 "Must have member initializer!");
368 assert(memberInit->
getInit() &&
"Must have initializer!");
400 unsigned srcArgIndex =
412 lhs.isVolatileQualified());
416 "Arrays of non-record types shouldn't need EH cleanup");
427 const CXXRecordDecl *baseClass;
429 CallBaseDtor(
const CXXRecordDecl *base,
bool baseIsVirtual)
430 : baseClass(base), baseIsVirtual(baseIsVirtual) {}
432 void emit(CIRGenFunction &cgf, Flags flags)
override {
433 const CXXRecordDecl *derivedClass =
436 const CXXDestructorDecl *d = baseClass->getDestructor();
440 assert(cgf.
currSrcLoc &&
"expected source location");
443 baseClass, baseIsVirtual);
445 false, addr, thisTy);
453 const CXXDestructorDecl *dtor;
457 CallDelegatingCtorDtor(
const CXXDestructorDecl *dtor, Address addr,
459 : dtor(dtor), addr(addr),
type(
type) {}
461 void emit(CIRGenFunction &cgf, Flags flags)
override {
462 QualType thisTy = dtor->getFunctionObjectParameterType();
489 return builder.createBaseClassAddr(loc, thisAddr,
convertType(base),
497 assert(
curFuncDecl &&
"loading 'this' without a func declaration?");
518 loc, thisPtr, classDecl, baseClassDecl, isBaseVirtual);
526 if (
cgm.getLangOpts().Exceptions && !baseClassDecl->hasTrivialDestructor())
550 bool constructVBases = ctorType !=
Ctor_Base &&
553 if (constructVBases &&
554 !
cgm.getTarget().getCXXABI().hasConstructorVariants()) {
556 "emitCtorPrologue: virtual base without variants");
561 auto allInits = cd->
inits();
564 auto virtualBaseEnd = std::find_if(
566 return !(Init->isBaseInitializer() && Init->isBaseVirtual());
569 auto nonVirtualBaseEnd = std::find_if(virtualBaseEnd, allInits.end(),
571 return !Init->isBaseInitializer();
575 auto virtualBaseInits = llvm::make_range(allInits.begin(), virtualBaseEnd);
576 auto nonVirtualBaseInits =
577 llvm::make_range(virtualBaseEnd, nonVirtualBaseEnd);
578 auto memberInits = llvm::make_range(nonVirtualBaseEnd, allInits.end());
583 if (
cgm.getCodeGenOpts().StrictVTablePointers &&
584 cgm.getCodeGenOpts().OptimizationLevel > 0 &&
589 "emitCtorPrologue: strict vtable pointers for vbase");
596 if (!constructVBases)
598 emitInitializer(virtualBaseInit);
605 assert(!nonVirtualBaseInit->isBaseVirtual());
606 emitInitializer(nonVirtualBaseInit);
621 assert(!member->isBaseInitializer());
622 assert(member->isAnyMemberInitializer() &&
623 "Delegating initializer on non-delegating constructor");
630 CharUnits nonVirtualOffset, mlir::Value virtualOffset,
632 mlir::Type baseValueTy = {},
bool assumeNotNull =
true) {
634 assert(!nonVirtualOffset.
isZero() || virtualOffset !=
nullptr);
637 mlir::Value baseOffset;
638 if (!nonVirtualOffset.
isZero()) {
646 assert(baseValueTy &&
"expected base type");
649 loc, addr, baseValueTy, nonVirtualOffset.
getQuantity(),
653 baseOffset = virtualOffset;
660 mlir::Type charPtrType =
663 mlir::Value adjusted = cir::PtrStrideOp::create(
664 cgf.
getBuilder(), loc, charPtrType, charPtr, baseOffset);
671 assert(nearestVBase &&
"virtual offset without vbase?");
679 return Address(ptr, alignment);
685 mlir::Value vtableAddressPoint =
686 cgm.getCXXABI().getVTableAddressPointInStructor(
689 if (!vtableAddressPoint)
693 mlir::Value virtualOffset{};
696 mlir::Type baseValueTy;
697 if (
cgm.getCXXABI().isVirtualOffsetNeededForVTableField(*
this, vptr)) {
700 virtualOffset =
cgm.getCXXABI().getVirtualBaseClassOffset(
712 if (!nonVirtualOffset.
isZero() || virtualOffset) {
714 loc, *
this, classAddr, nonVirtualOffset, virtualOffset,
723 cir::VTableGetVPtrOp::create(builder, loc, classAddr.
getPointer());
725 builder.createStore(loc, vtableAddressPoint, vtableField);
737 if (
cgm.getCXXABI().doStructorsInitializeVPtrs(rd))
742 cgm.getCXXABI().initializeHiddenVirtualInheritanceMembers(*
this, rd);
752 false, vtableClass, vbases,
760 bool baseIsNonVirtualPrimaryBase,
766 if (!baseIsNonVirtualPrimaryBase) {
768 VPtr vptr = {base, nearestVBase, offsetFromNearestVBase, vtableClass};
769 vptrs.push_back(vptr);
774 for (
const auto &nextBase : rd->
bases()) {
775 const auto *baseDecl =
777 ->getDefinitionOrSelf();
780 if (!baseDecl->isDynamicClass())
785 bool baseDeclIsNonVirtualPrimaryBase;
788 if (nextBase.isVirtual()) {
790 if (!vbases.insert(baseDecl).second)
796 nextBaseDecl = baseDecl;
799 baseDeclIsNonVirtualPrimaryBase =
false;
803 nextBaseDecl = nearestVBase;
805 baseOffsetFromNearestVBase =
807 baseDeclIsNonVirtualPrimaryBase = layout.
getPrimaryBase() == baseDecl;
811 baseOffsetFromNearestVBase,
812 baseDeclIsNonVirtualPrimaryBase, vtableClass, vbases,
818 assert(
curFuncDecl &&
"loading 'this' without a func declaration?");
866 const Expr *e,
Address base, mlir::Value memberPtr,
870 cir::GetRuntimeMemberOp op = builder.createGetIndirectMember(
875 CharUnits memberAlign =
cgm.getNaturalTypeAlignment(memberType, baseInfo);
876 memberAlign =
cgm.getDynamicOffsetAlignment(
891 return std::min(actualBaseAlign, expectedTargetAlign);
915 if (actualBaseAlign >= expectedBaseAlign)
916 return expectedTargetAlign;
921 return std::min(actualBaseAlign, expectedTargetAlign);
953 bool zeroInitialize) {
957 newPointerIsChecked, zeroInitialize,
989 while (
auto maybeArrayTy = mlir::dyn_cast<cir::ArrayType>(elementType))
990 elementType = maybeArrayTy.getElementType();
991 cir::PointerType ptrToElmType =
994 bool useDynamicArrayCtor =
true;
995 uint64_t constElementCount = 0;
996 if (
auto constantOp = numElements.getDefiningOp<cir::ConstantOp>()) {
998 if (constElementCount == 0)
1000 if (constantOp.use_empty())
1002 useDynamicArrayCtor =
false;
1020 mlir::Value dynamicElPtr;
1021 if (useDynamicArrayCtor)
1023 builder.createPtrBitcast(arrayBase.
getPointer(), elementType);
1029 bool needsPartialArrayCleanup =
getLangOpts().Exceptions &&
1033 auto emitCtorBody = [&](mlir::OpBuilder &b, mlir::Location l) {
1034 mlir::BlockArgument arg =
1035 b.getInsertionBlock()->addArgument(ptrToElmType, l);
1041 builder.createStore(l, arg, endOfInit);
1063 cir::YieldOp::create(b, l);
1066 llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)>
1067 emitPartialDtorBody =
nullptr;
1068 auto partialDtorBuilder = [&](mlir::OpBuilder &b, mlir::Location l) {
1069 mlir::BlockArgument arg =
1070 b.getInsertionBlock()->addArgument(ptrToElmType, l);
1074 false, curAddr,
type);
1075 cir::YieldOp::create(b, l);
1077 if (needsPartialArrayCleanup)
1078 emitPartialDtorBody = partialDtorBuilder;
1080 if (useDynamicArrayCtor) {
1081 cir::ArrayCtor::create(builder, loc, dynamicElPtr, numElements,
1082 emitCtorBody, emitPartialDtorBody);
1084 cir::ArrayType arrayTy =
1085 cir::ArrayType::get(elementType, constElementCount);
1086 mlir::Value arrayOp =
1087 builder.createPtrBitcast(arrayBase.
getPointer(), arrayTy);
1088 cir::ArrayCtor::create(builder, loc, arrayOp, emitCtorBody,
1089 emitPartialDtorBody);
1098 FunctionArgList::const_iterator i = args.begin(), e = args.end();
1099 assert(i != e &&
"no parameters to constructor");
1108 if (
cgm.getCXXABI().needsVTTParameter(
curGD)) {
1109 cgm.errorNYI(loc,
"emitDelegateCXXConstructorCall: VTT parameter");
1114 for (; i != e; ++i) {
1123 true, thisAddr, delegateArgs, loc);
1128 assert(assignOp->isCopyAssignmentOperator() ||
1129 assignOp->isMoveAssignmentOperator());
1130 const Stmt *rootS = assignOp->getBody();
1132 "Body of an implicit assignment operator should be compound stmt.");
1140 AssignmentMemcpyizer AM(*
this, assignOp, args);
1141 for (
auto *i : rootCS->body())
1142 AM.emitAssignment(i);
1150 cgm.getTypes().arrangeCXXMethodDeclaration(callOperator);
1151 cir::FuncOp calleePtr =
cgm.getAddrOfFunction(
1152 GlobalDecl(callOperator),
cgm.getTypes().getFunctionType(calleeFnInfo));
1180 if (!resultType->isVoidType()) {
1182 resultType->isObjCRetainableType())
1184 "emitForwardingCallToLambda: ObjCAutoRefCount");
1215 llvm::FoldingSetInsertToken InsertToken;
1218 assert(correspondingCallOpSpecialization);
1238 const auto *record =
type->castAsCXXRecordDecl();
1269 const FieldDecl *field;
1274 : field(field), destroyer(destroyer) {}
1276 void emit(CIRGenFunction &cgf, Flags flags)
override {
1283 assert(lv.isSimple());
1286 cgf.
emitDestroy(lv.getAddress(), field->getType(), destroyer);
1300 "Should not emit dtor epilogue for non-exported trivial dtor!");
1306 "operator delete missing - EnterDtorCleanups");
1310 assert(
getTarget().getCXXABI().isMicrosoft() &&
1311 "only the Microsoft ABI passes an implicit deleting dtor param");
1313 "deleting destructor with conditional delete: MSVC ABI");
1317 "destroying operator delete is handled by emitDestructorBody");
1336 auto *baseClassDecl = base.getType()->castAsCXXRecordDecl();
1338 if (baseClassDecl->hasTrivialDestructor()) {
1358 if (base.isVirtual())
1361 CXXRecordDecl *baseClassDecl = base.getType()->getAsCXXRecordDecl();
1380 const RecordType *rt =
type->getAsUnionType();
1381 if (rt && rt->getDecl()->isAnonymousStructOrUnion())
1386 ehStack.pushCleanup<DestroyField>(cleanupKind, field,
1410 ehStack.pushCleanup<CallDelegatingCtorDtor>(
1417 bool forVirtualBase,
bool delegating,
1419 cgm.getCXXABI().emitDestructorCall(*
this, dd,
type, forVirtualBase,
1420 delegating, thisAddr, thisTy);
1425 if (!
cgm.getCXXABI().needsVTTParameter(gd))
1431 uint64_t subVTTIndex;
1436 }
else if (rd == base) {
1439 assert(!
cgm.getCXXABI().needsVTTParameter(
curGD) &&
1440 "doing no-op VTT offset in base dtor/ctor?");
1441 assert(!forVirtualBase &&
"Can't have same class as virtual base!");
1450 assert(subVTTIndex != 0 &&
"Sub-VTT index must be greater than zero!");
1454 if (
cgm.getCXXABI().needsVTTParameter(
curGD)) {
1457 return builder.createVTTAddrPoint(loc, vtt.getType(), vtt, subVTTIndex);
1460 cir::GlobalOp vtt =
cgm.getVTables().getAddrOfVTT(rd);
1462 cir::PointerType vttTy =
1463 builder.getPointerTo(
voidPtrTy, vtt.getAddrSpaceAttr());
1464 auto vttSym = mlir::FlatSymbolRefAttr::get(vtt.getSymNameAttr());
1465 return builder.createVTTAddrPoint(loc, vttTy, vttSym, subVTTIndex);
1471 llvm::iterator_range<CastExpr::path_const_iterator> path,
1472 bool nullCheckValue) {
1473 assert(!path.empty() &&
"Base path should not be empty!");
1476 mlir::Type derivedValueTy =
convertType(derivedTy);
1478 cgm.computeNonVirtualBaseClassOffset(derived, path);
1483 return builder.createDerivedClassAddr(loc, baseAddr, derivedValueTy,
1490 llvm::iterator_range<CastExpr::path_const_iterator> path,
1492 assert(!path.empty() &&
"Base path should not be empty!");
1497 if ((*path.begin())->isVirtual()) {
1498 vBase = (*start)->getType()->castAsCXXRecordDecl();
1505 CharUnits nonVirtualOffset =
cgm.computeNonVirtualBaseClassOffset(
1506 vBase ? vBase : derived, {start, path.end()});
1511 if (vBase && derived->
hasAttr<FinalAttr>()) {
1514 nonVirtualOffset += vBaseOffset;
1519 mlir::Type baseValueTy =
convertType((path.end()[-1])->getType());
1523 if (nonVirtualOffset.
isZero() && !vBase) {
1525 return builder.createBaseClassAddr(
getLoc(loc), value, baseValueTy, 0,
1531 mlir::Location mlirLoc =
getLoc(loc);
1536 if (vBase && nullCheckValue) {
1539 .alignmentAtOffset(nonVirtualOffset);
1540 mlir::Type basePtrTy =
1542 mlir::Value ptrIsNull = builder.createPtrIsNull(value.
getPointer());
1543 mlir::Value result =
1544 cir::TernaryOp::create(
1545 builder, mlirLoc, ptrIsNull,
1546 [&](mlir::OpBuilder &, mlir::Location) {
1547 builder.createYield(
1548 mlirLoc, builder.getNullPtr(basePtrTy, mlirLoc).getResult());
1550 [&](mlir::OpBuilder &, mlir::Location) {
1551 mlir::Value virtualOffset =
1552 cgm.getCXXABI().getVirtualBaseClassOffset(
1553 mlirLoc, *
this, value, derived, vBase);
1555 mlirLoc, *
this, value, nonVirtualOffset, virtualOffset,
1556 derived, vBase, baseValueTy,
true);
1558 builder.createYield(mlirLoc, adjusted.
getPointer());
1561 return Address(result, baseValueTy, alignment);
1565 mlir::Value virtualOffset =
nullptr;
1567 virtualOffset =
cgm.getCXXABI().getVirtualBaseClassOffset(
1568 mlirLoc, *
this, value, derived, vBase);
1573 mlirLoc, *
this, value, nonVirtualOffset, virtualOffset, derived, vBase,
1574 baseValueTy,
not nullCheckValue);
1585 if (!
cgm.getCodeGenOpts().WholeProgramVTables)
1588 if (
cgm.getCodeGenOpts().VirtualFunctionElimination)
1599 cir::VTableGetVPtrOp::create(builder, loc, thisAddr.
getPointer());
1602 auto vtable = builder.createLoad(loc, vtablePtrAddr);
1605 if (
cgm.getCodeGenOpts().OptimizationLevel > 0 &&
1606 cgm.getCodeGenOpts().StrictVTablePointers) {
1615 bool forVirtualBase,
1629 assert(e->
getNumArgs() == 1 &&
"unexpected argcount for trivial ctor");
1644 ? EvaluationOrder::ForceLeftToRight
1645 : EvaluationOrder::Default;
1648 !inherited ||
cgm.getTypes().inheritingCtorHasParams(inherited,
type))
1673 "canEmitDelegateCallArgs: args-destroyed-L-to-R in callee");
1688 if (inheritedFromVBase &&
1689 cgm.getTarget().getCXXABI().hasConstructorVariants()) {
1692 ctorArgs.push_back(thisArg);
1696 "wrong number of parameters for inherited constructor call");
1698 ctorArgs[0] = thisArg;
1700 ctorArgs.push_back(thisArg);
1702 assert(outerCtor->getNumParams() == d->
getNumParams());
1703 assert(!outerCtor->isVariadic() &&
"should have been inlined");
1705 for (
const ParmVarDecl *param : outerCtor->parameters()) {
1707 outerCtor->getParamDecl(param->getFunctionScopeIndex())->getType(),
1711 if (param->hasAttr<PassObjectSizeAttr>())
1714 "emitInheritedCXXConstructorCall: pass object size attr argument");
1724 bool forVirtualBase,
bool delegating,
CallArgList &args) {
1728 InlinedInheritingConstructorScope scope(*
this, gd);
1741 cgm.getCXXABI().addImplicitConstructorArgs(*
this, d, ctorType, forVirtualBase,
1745 assert(args.size() >= params.size() &&
"too few arguments for call");
1746 for (
auto [idx, arg, parm] :
1747 llvm::zip_longest(llvm::index_range{0, args.size()}, args, params)) {
1749 mlir::Location parmLoc =
getLoc((*parm)->getSourceRange());
1750 RValue argVal = arg->getRValue(*
this, parmLoc);
1755 (*parm)->getType());
1767 "emitInlinedInheritingCXXConstructorCall: non-void return");
1769 cgm.getCXXABI().emitInstanceFunctionProlog(loc, *
this);
1789 bool passPrototypeArgs =
true;
1794 if (passPrototypeArgs &&
1804 cgm.getCXXABI().addImplicitConstructorArgs(*
this, d,
type, forVirtualBase,
1812 cir::CIRCallOpInterface c;
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 Address applyNonVirtualAndVirtualOffset(mlir::Location loc, CIRGenFunction &cgf, Address addr, CharUnits nonVirtualOffset, mlir::Value virtualOffset, const CXXRecordDecl *derivedClass, const CXXRecordDecl *nearestVBase, mlir::Type baseValueTy={}, bool assumeNotNull=true)
static void emitMemberInitializer(CIRGenFunction &cgf, const CXXRecordDecl *classDecl, CXXCtorInitializer *memberInit, const CXXConstructorDecl *constructor, FunctionArgList &args)
static bool canEmitDelegateCallArgs(CIRGenModule &cgm, ASTContext &ctx, const CXXConstructorDecl *d, CXXCtorType type)
static void emitLValueForAnyFieldInitialization(CIRGenFunction &cgf, CXXCtorInitializer *memberInit, LValue &lhs)
Defines the clang::Expr interface and subclasses for C++ expressions.
C Language Family Type Representation.
mlir::Value createAdd(mlir::Location loc, mlir::Value lhs, mlir::Value rhs, OverflowFlags flags=OverflowFlags::None)
cir::PointerType getPointerTo(mlir::Type ty)
mlir::Value createBitcast(mlir::Value src, mlir::Type newTy)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
const TargetInfo & getTargetInfo() const
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
CanQualType getCanonicalTagType(const TagDecl *TD) const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getSize() const
getSize - Get the record size in characters.
CharUnits getNonVirtualAlignment() const
getNonVirtualAlignment - Get the non-virtual alignment (in chars) of an object, which is the alignmen...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
const CXXRecordDecl * getPrimaryBase() const
getPrimaryBase - Get the primary base for this record.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
const CXXRecordDecl * getBase() const
getBase - Returns the base class declaration.
CharUnits getBaseOffset() const
getBaseOffset - Returns the base class offset.
mlir::ptr::MemorySpaceAttrInterface getAddressSpace() const
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
Overlap_t mayOverlap() const
static AggValueSlot forAddr(Address addr, clang::Qualifiers quals, IsDestructed_t isDestructed, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed)
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed)
Address getAddress() const
cir::LoadOp createLoad(mlir::Location loc, Address addr, bool isVolatile=false, bool isNontemporal=false)
Address createBaseClassAddr(mlir::Location loc, Address addr, mlir::Type destType, unsigned offset, bool assumeNotNull)
cir::MemCpyOp createMemCpy(mlir::Location loc, Address dst, Address src, mlir::Value len)
cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal)
virtual size_t getSrcArgforCopyCtor(const CXXConstructorDecl *, FunctionArgList &args) const =0
static CIRGenCallee forDirect(mlir::Operation *funcPtr, const CIRGenCalleeInfo &abstractInfo=CIRGenCalleeInfo())
A scope within which we are constructing the fields of an object which might use a CXXDefaultInitExpr...
void deferLifetimeExtendedCleanups()
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited.
static bool isConstructorDelegationValid(const clang::CXXConstructorDecl *ctor)
Checks whether the given constructor is a valid subject for the complete-to-base constructor delegati...
void emitLambdaDelegatingInvokeBody(const CXXMethodDecl *md)
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...
Address emitCXXMemberDataPointerAddress(const Expr *e, Address base, mlir::Value memberPtr, const MemberPointerType *memberPtrType, LValueBaseInfo *baseInfo)
CIRGenTypes & getTypes() const
const clang::LangOptions & getLangOpts() const
mlir::Value cxxStructorImplicitParamValue
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,...
void emitForwardingCallToLambda(const CXXMethodDecl *lambdaCallOperator, CallArgList &callArgs)
mlir::Value loadCXXThis()
Load the value for 'this'.
LValue makeNaturalAlignPointeeAddrLValue(mlir::Value v, clang::QualType t)
Given a value of type T* that may not be to a complete object, construct an l-vlaue withi the natural...
void emitDeleteCall(const FunctionDecl *deleteFD, mlir::Value ptr, QualType deleteTy)
clang::CharUnits cxxThisAlignment
const TargetInfo & getTarget() const
LValue emitLValue(const clang::Expr *e)
Emit code to compute a designator that specifies the location of the expression.
const clang::Decl * curFuncDecl
Address loadCXXThisAddress()
void emitInlinedInheritingCXXConstructorCall(SourceLocation loc, const CXXConstructorDecl *d, CXXCtorType ctorType, bool forVirtualBase, bool delegating, CallArgList &args)
Address getAddrOfLocalVar(const clang::VarDecl *vd)
Return the address of a local variable.
void emitAggregateCopy(LValue dest, LValue src, QualType eltTy, AggValueSlot::Overlap_t mayOverlap, bool isVolatile=false)
Emit an aggregate copy.
LValue makeNaturalAlignAddrLValue(mlir::Value val, QualType ty)
mlir::Value getVTTParameter(GlobalDecl gd, bool forVirtualBase, bool delegating)
Return the VTT parameter that should be passed to a base constructor/destructor with virtual bases.
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
void initializeVTablePointers(mlir::Location loc, const clang::CXXRecordDecl *rd)
CodeGenUtils::EvaluationOrder EvaluationOrder
void initializeVTablePointer(mlir::Location loc, const VPtr &vptr)
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)
Address getAddressOfBaseClass(Address value, const CXXRecordDecl *derived, llvm::iterator_range< CastExpr::path_const_iterator > path, bool nullCheckValue, SourceLocation loc)
void emitDelegateCXXConstructorCall(const clang::CXXConstructorDecl *ctor, clang::CXXCtorType ctorType, const FunctionArgList &args, clang::SourceLocation loc)
void emitBaseInitializer(mlir::Location loc, const CXXRecordDecl *classDecl, CXXCtorInitializer *baseInit)
void emitExprAsInit(const clang::Expr *init, const clang::ValueDecl *d, LValue lvalue, bool capturedByInit=false)
Emit an expression as an initializer for an object (variable, field, etc.) at the given location.
mlir::Value emitArrayLength(const clang::ArrayType *arrayType, QualType &baseType, Address &addr)
Computes the length of an array in elements, as well as the base element type and a properly-typed fi...
void emitNullInitialization(mlir::Location loc, Address destPtr, QualType ty)
VPtrsVector getVTablePointers(const clang::CXXRecordDecl *vtableClass)
llvm::ScopedHashTableScope< const clang::Decl *, mlir::Value > SymTableScopeTy
CleanupKind getCleanupKind(QualType::DestructionKind kind)
AggValueSlot::Overlap_t getOverlapForFieldInit(const FieldDecl *fd)
mlir::Operation * curFn
The current function or global initializer that is generated code for.
Address getAddressOfDerivedClass(mlir::Location loc, Address baseAddr, const CXXRecordDecl *derived, llvm::iterator_range< CastExpr::path_const_iterator > path, bool nullCheckValue)
CallArgList cxxInheritedCtorInitExprArgs
The values of function arguments to use when evaluating CXXInheritedCtorInitExprs within this context...
EHScopeStack ehStack
Tracks function scope overall cleanup handling.
void enterDtorCleanups(const CXXDestructorDecl *dtor, CXXDtorType type)
Enter the cleanups necessary to complete the given phase of destruction for a destructor.
void emitImplicitAssignmentOperatorBody(FunctionArgList &args)
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::Type convertTypeForMem(QualType t)
clang::QualType buildFunctionArgList(clang::GlobalDecl gd, FunctionArgList &args)
void emitCtorPrologue(const clang::CXXConstructorDecl *ctor, clang::CXXCtorType ctorType, FunctionArgList &args)
This routine generates necessary code to initialize base classes and non-static data members belongin...
mlir::Value loadCXXVTT()
Load the VTT parameter to base constructors/destructors have virtual bases.
static Destroyer destroyCXXObject
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)
static bool hasAggregateEvaluationKind(clang::QualType type)
mlir::Value getVTablePtr(mlir::Location loc, Address thisAddr, const clang::CXXRecordDecl *vtableClass)
Return the Value of the vtable pointer member pointed to by thisAddr.
llvm::SmallPtrSet< const clang::CXXRecordDecl *, 4 > VisitedVirtualBasesSetTy
void emitReturnOfRValue(mlir::Location loc, RValue rv, QualType ty)
bool shouldEmitVTableTypeCheckedLoad(const CXXRecordDecl *rd)
Returns whether we should perform a type checked load when loading a virtual function for virtual cal...
const clang::Decl * curCodeDecl
This is the inner-most code context, which includes blocks.
LValue emitLValueForFieldInitialization(LValue base, const clang::FieldDecl *field, llvm::StringRef fieldName)
Like emitLValueForField, excpet that if the Field is a reference, this will return the address of the...
mlir::Value getAsNaturalPointerTo(Address addr, QualType pointeeType)
void emitInitializerForField(clang::FieldDecl *field, LValue lhs, clang::Expr *init)
mlir::Value loadThisForDtorDelete(const CXXDestructorDecl *dd)
Return the pointer to pass to the operator delete of the given destructor, converted to the type of i...
LValue emitLValueForField(LValue base, const clang::FieldDecl *field)
mlir::Value emitScalarExpr(const clang::Expr *e, bool ignoreResultAssign=false)
Emit the computation of the specified expression of scalar type.
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind.
Address getAddressOfDirectBaseInCompleteClass(mlir::Location loc, Address value, const CXXRecordDecl *derived, const CXXRecordDecl *base, bool baseIsVirtual)
Convert the given pointer to a complete class to the given direct base.
CIRGenBuilderTy & getBuilder()
AggValueSlot::Overlap_t getOverlapForBaseInit(const CXXRecordDecl *rd, const CXXRecordDecl *baseRD, bool isVirtual)
Determine whether a base class initialization may overlap some other object.
void emitDestroy(Address addr, QualType type, Destroyer *destroyer)
Immediately perform the destruction of the given object.
Destroyer * getDestroyer(clang::QualType::DestructionKind kind)
void Destroyer(CIRGenFunction &cgf, Address addr, QualType ty)
std::optional< SourceRange > currSrcLoc
Use to track source locations across nested visitor traversals.
void emitComplexExprIntoLValue(const Expr *e, LValue dest, bool isInit)
void pushEHDestroyIfNeeded(QualType::DestructionKind dtorKind, Address addr, QualType type)
pushEHDestroyIfNeeded - Push the standard destructor for the given type as an EH-only cleanup.
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)
llvm::SmallVector< VPtr, 4 > VPtrsVector
void emitLambdaStaticInvokeBody(const CXXMethodDecl *md)
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.
void emitDelegateCallArg(CallArgList &args, const clang::VarDecl *param, clang::SourceLocation loc)
We are performing a delegate call; that is, the current function is delegating to another one.
clang::ASTContext & getContext() const
void setAddrOfLocalVar(const clang::VarDecl *vd, Address addr)
Set the address of a local variable.
void emitInheritedCXXConstructorCall(const CXXConstructorDecl *d, bool forVirtualBase, Address thisAddr, bool inheritedFromVBase, const CXXInheritedCtorInitExpr *e)
void emitStoreThroughLValue(RValue src, LValue dst, bool isInit=false)
Store the specified rvalue into the specified lvalue, where both are guaranteed to the have the same ...
mlir::Value cxxabiThisValue
mlir::LogicalResult emitStmt(const clang::Stmt *s, bool useCurrentScope, llvm::ArrayRef< const Attr * > attrs={})
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...
void emitDelegatingCXXConstructorCall(const CXXConstructorDecl *ctor, const FunctionArgList &args)
void emitAggExpr(const clang::Expr *e, AggValueSlot slot)
This class organizes the cross-function state that is used while generating CIR code.
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
clang::ASTContext & getASTContext() const
CharUnits getDynamicOffsetAlignment(CharUnits actualBaseAlign, const CXXRecordDecl *baseDecl, CharUnits expectedTargetAlign)
TODO: Add TBAAAccessInfo.
CharUnits getMinimumClassObjectSize(const CXXRecordDecl *cd)
Returns the minimum object size for an object of the given class type (or a class derived from it).
clang::DiagnosticsEngine & getDiags() const
CharUnits getVBaseAlignment(CharUnits derivedAlign, const CXXRecordDecl *derived, const CXXRecordDecl *vbase)
Returns the assumed alignment of a virtual base of a class.
CIRGenCXXABI & getCXXABI() const
const CIRGenBitFieldInfo & getBitFieldInfo(const clang::FieldDecl *fd) const
Return the BitFieldInfo that corresponds to the field FD.
bool inheritingCtorHasParams(const InheritedConstructor &inherited, CXXCtorType type)
Determine if a C++ inheriting constructor should have parameters matching those of its inherited cons...
void add(RValue rvalue, clang::QualType type)
Information for lazily generating a cleanup.
Type for representing both the decl and type of parameters to a function.
Address getAddress() const
clang::QualType getType() const
This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(mlir::Value v)
Contains the address where the return value of a function can be stored, and whether the address is v...
Represents a base class of a C++ class.
Represents a call to a C++ constructor.
Expr * getArg(unsigned Arg)
Return the specified argument.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
init_iterator init_begin()
Retrieve an iterator to the first initializer.
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
bool isCopyOrMoveConstructor(unsigned &TypeQuals) const
Determine whether this is a copy or move constructor.
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Represents a C++ base or member initializer.
Expr * getInit() const
Get the initializer.
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
bool isAnyMemberInitializer() const
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
bool isIndirectMemberInitializer() const
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
FieldDecl * getAnyMember() const
IndirectFieldDecl * getIndirectMember() const
bool isBaseVirtual() const
Returns whether the base is virtual or not.
Represents a C++ destructor within a class.
const FunctionDecl * getOperatorDelete() const
Expr * getOperatorDeleteThisArg() const
Represents a call to an inherited base class constructor from an inheriting constructor.
SourceLocation getLocation() 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.
QualType getThisType() const
Return the type of the this pointer.
QualType getFunctionObjectParameterType() const
bool isMemcpyEquivalentSpecialMember(const ASTContext &Ctx) const
Returns whether this is a copy/move constructor or assignment operator that can be implemented as a m...
Represents a C++ struct/union/class.
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
base_class_range vbases()
bool isAbstract() const
Determine whether this class has a pure virtual function.
bool isDynamicClass() const
bool hasDefinition() const
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
const CXXBaseSpecifier *const * path_const_iterator
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?
bool isZero() const
Test whether the quantity equals zero.
QuantityType getQuantity() const
Get the raw integer representation of this quantity.
static CharUnits One()
Construct a CharUnits quantity of one.
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
static CharUnits Zero()
Construct a CharUnits quantity of zero.
Represents the canonical version of C arrays with a specified constant size.
SourceLocation getBeginLoc() const LLVM_READONLY
bool hasErrorOccurred() const
This represents one expression.
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.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
bool isZeroSize(const ASTContext &Ctx) const
Determine if this field is a subobject of zero size, that is, either a zero-length bit-field or a fie...
Represents a function declaration or definition.
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
ArrayRef< ParmVarDecl * > parameters() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool isVariadic() const
Whether this function is variadic.
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
bool isDefaulted() const
Whether this function is defaulted.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Represents a prototype with parameter type info, e.g.
bool isVariadic() const
Whether this function prototype is variadic.
Declaration of a template function.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, llvm::FoldingSetInsertToken &InsertToken)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
QualType getReturnType() const
GlobalDecl - represents a global declaration.
CXXCtorType getCtorType() const
const Decl * getDecl() const
Represents a field injected from an anonymous union/struct into the parent scope.
ArrayRef< NamedDecl * > chain() const
A pointer to member type per C++ 8.3.3 - Pointers to members.
CXXRecordDecl * getMostRecentCXXRecordDecl() const
Note: this can trigger extra deserialization when external AST sources are used.
QualType getPointeeType() const
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Represents a parameter to a function.
A (possibly-)qualified type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
The collection of all-type qualifiers we support.
bool hasObjCLifetime() const
field_range fields() const
Encodes a location in the source.
Stmt - This represents one statement.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
bool areArgsDestroyedLeftToRightInCallee() const
Are arguments to a call destroyed left to right in the callee?
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
A template argument list.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
SourceLocation getBeginLoc() const LLVM_READONLY
CXXRecordDecl * castAsCXXRecordDecl() const
const T * castAs() const
Member-template castAs<specific type>.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isRecordType() const
Represents a variable declaration or definition.
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
@ EHCleanup
Denotes a cleanup that should run when a scope is exited using exceptional control flow (a throw stat...
bool isInitializerOfDynamicClass(const CXXCtorInitializer *BaseInit)
Return whether BaseInit initializes a base class that is dynamic, that is, one whose vtable pointer m...
bool isEmptyFieldForLayout(const ASTContext &Ctx, const FieldDecl *FD)
Return true iff the field is "empty", that is, either a zero-width bit-field or an isEmptyRecordForLa...
bool baseInitializerUsesThis(ASTContext &Ctx, const Expr *Init)
Check whether Init uses 'this' in a way which requires the vtable to be properly set.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
@ Address
A pointer to a ValueDecl.
Top level wrappers for InstallAPI frontend operations.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
CXXCtorType
C++ constructor types.
@ Ctor_Base
Base object ctor.
@ Ctor_Complete
Complete object ctor.
bool isa(CodeGen::Address addr)
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
CXXDtorType
C++ destructor types.
@ Dtor_Base
Base object dtor.
@ Dtor_Complete
Complete object dtor.
@ Dtor_Deleting
Deleting dtor.
U cast(CodeGen::Address addr)
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 uint64_t
static bool addressSpace()
static bool useEHCleanupForArray()
static bool aggValueSlotGC()
static bool hiddenVisibility()
static bool runCleanupsScope()
static bool createInvariantGroup()
static bool isTrivialCtorOrDtor()
static bool pointerAuthentication()
static bool returnValueSlotFeatures()
static bool ctorMemcpyizer()
static bool generateDebugInfo()
static bool pointerFieldProtection()
static bool incrementProfileCounter()
clang::CharUnits storageOffset
The offset of the bitfield storage from the start of the record.
Similar to AddedStructorArgs, but only notes the number of additional arguments.
const clang::CXXRecordDecl * vtableClass
clang::CharUnits offsetFromNearestVBase
const clang::CXXRecordDecl * nearestVBase
clang::BaseSubobject base
cir::PointerType voidPtrTy
void* in address space 0