Lines Matching +full:x +full:- +full:tal
1 //===--- CGClass.cpp - Emit LLVM Code for C++ classes -----------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
42 if (!RD->hasDefinition())
49 if (RD->isEffectivelyFinal())
61 if (!RD->hasDefinition())
68 if (RD->isEffectivelyFinal())
83 assert(vbaseClass->isCompleteDefinition());
97 if (!baseDecl->isCompleteDefinition())
105 // This actually isn't necessarily the right thing to do --- if the
112 // However, our approach to this kind of under-alignment can only
116 // than pointer-aligned will generally trap in the constructor,
120 // under-aligned and then safely access its fields and vtables.
138 // TODO: if we're currently emitting a complete-object ctor/dtor,
139 // we can always use the complete-object alignment.
140 CXXThisAlignment = CGM.getClassPointerAlignment(MD->getParent());
144 LoadCXXThis(), MD->getFunctionObjectParameterType(), CXXThisAlignment,
162 QualType memberType = memberPtrType->getPointeeType();
167 memberPtrType->getClass()->getAsCXXRecordDecl(),
169 return Address(ptr, ConvertTypeForMem(memberPtrType->getPointeeType()),
183 assert(!Base->isVirtual() && "Should not see virtual bases here!");
189 cast<CXXRecordDecl>(Base->getType()->castAs<RecordType>()->getDecl());
218 /// This should only be used for (1) non-virtual bases or (2) virtual bases
221 /// The object pointed to by 'This' is assumed to be non-null.
307 if ((*Start)->isVirtual()) {
309 (*Start)->getType()->castAs<RecordType>()->getDecl());
321 // TODO: "devirtualize" this for accesses to known-complete objects.
322 if (VBase && Derived->hasAttr<FinalAttr>()) {
330 llvm::Type *BaseValueTy = ConvertType((PathEnd[-1])->getType());
332 CGM.getLLVMContext(), Value.getType()->getPointerAddressSpace());
353 // null-check the pointer.
393 PHI->addIncoming(Value.emitRawPointer(*this), notNullBB);
394 PHI->addIncoming(llvm::Constant::getNullValue(PtrTy), origBB);
444 // Produce a PHI if we had a null-check.
452 llvm::PHINode *PHI = Builder.CreatePHI(Value->getType(), 2);
453 PHI->addIncoming(Value, CastNotNull);
454 PHI->addIncoming(llvm::Constant::getNullValue(Value->getType()), CastNull);
470 const CXXRecordDecl *RD = cast<CXXMethodDecl>(CurCodeDecl)->getParent();
471 const CXXRecordDecl *Base = cast<CXXMethodDecl>(GD.getDecl())->getParent();
482 "doing no-op VTT offset in base dtor/ctor?");
493 assert(SubVTTIndex != 0 && "Sub-VTT index must be greater than zero!");
504 VTT->getValueType(), VTT, 0, SubVTTIndex);
518 cast<CXXMethodDecl>(CGF.CurCodeDecl)->getParent();
520 const CXXDestructorDecl *D = BaseClass->getDestructor();
523 QualType ThisTy = D->getFunctionObjectParameterType();
542 // Black-list all explicit and implicit references to 'this'.
560 assert(BaseInit->isBaseInitializer() &&
565 const Type *BaseType = BaseInit->getBaseClass();
567 cast<CXXRecordDecl>(BaseType->castAs<RecordType>()->getDecl());
569 bool isBaseVirtual = BaseInit->isBaseVirtual();
574 if (BaseInitializerUsesThis(CGF.getContext(), BaseInit->getInit()))
591 CGF.EmitAggExpr(BaseInit->getInit(), AggSlot);
594 !BaseClassDecl->hasTrivialDestructor())
601 if (!(CD && CD->isCopyOrMoveConstructor()) &&
602 !D->isCopyAssignmentOperator() && !D->isMoveAssignmentOperator())
606 if (D->isTrivial() && !D->getParent()->mayInsertExtraPadding())
610 if (D->getParent()->isUnion() && D->isDefaulted())
619 FieldDecl *Field = MemberInit->getAnyMember();
620 if (MemberInit->isIndirectMemberInitializer()) {
622 IndirectFieldDecl *IndirectField = MemberInit->getIndirectMember();
623 for (const auto *I : IndirectField->chain())
635 ApplyDebugLocation Loc(CGF, MemberInit->getSourceLocation());
636 assert(MemberInit->isAnyMemberInitializer() &&
638 assert(MemberInit->getInit() && "Must have initializer!");
640 // non-static data member initializers.
641 FieldDecl *Field = MemberInit->getAnyMember();
642 QualType FieldType = Field->getType();
649 // non-virtual alignment.
664 if (Array && Constructor->isDefaulted() &&
665 Constructor->isCopyOrMoveConstructor()) {
667 CXXConstructExpr *CE = dyn_cast<CXXConstructExpr>(MemberInit->getInit());
669 (CE && isMemcpyEquivalentSpecialMember(CE->getConstructor()))) {
689 CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit());
694 QualType FieldType = Field->getType();
727 /// complete-to-base constructor delegation optimization, i.e.
745 if (Ctor->getParent()->getNumVBases()) {
746 // TODO: white-list trivial vbase initializers. This case wouldn't
749 // TODO: white-list cases where:
750 // - there are no non-reference parameters to the constructor
751 // - the initializers don't access any non-reference parameters
752 // - the initializers don't take the address of non-reference
754 // - etc.
756 // - function-try-blocks will always exclude this optimization
757 // - we need to perform the constructor prologue and cleanup in
764 // it's impossible to "re-pass" varargs.
765 if (Ctor->getType()->castAs<FunctionProtoType>()->isVariadic())
769 if (Ctor->isDelegatingConstructor())
777 // -fsanitize-address-field-padding=1|2.
781 Prologue ? cast<CXXConstructorDecl>(CurGD.getDecl())->getParent()
782 : cast<CXXDestructorDecl>(CurGD.getDecl())->getParent();
783 if (!ClassDecl->mayInsertExtraPadding()) return;
800 for (const auto *Field : ClassDecl->fields()) {
802 auto FieldInfo = Context.getTypeInfoInChars(D->getType());
805 SSV[NumFields].Size = D->isBitField() ? 0 : FieldSize.getQuantity();
811 // We will insert calls to __asan_* run-time functions.
827 uint64_t NextField = i == SSV.size() - 1 ? TypeSize : SSV[i + 1].Offset;
828 uint64_t PoisonSize = NextField - SSV[i].Offset - SSV[i].Size;
839 /// EmitConstructorBody - Emits the body of the current constructor.
849 // Before we go any further, try the complete->base constructor
853 EmitDelegateCXXConstructorCall(Ctor, Ctor_Base, Args, Ctor->getEndLoc());
858 Stmt *Body = Ctor->getBody(Definition);
861 // Enter the function-try-block before the constructor prologue if
881 EmitStmt(cast<CXXTryStmt>(Body)->getTryBlock());
899 /// lvalue-to-rvalue conversion on the object but not its members.
930 Qualifiers Qual = F->getType().getQualifiers();
948 LastField->isBitField()
949 ? LastField->getBitWidthValue(Ctx)
951 Ctx.getTypeInfoDataSizeInChars(LastField->getType()).Width);
952 uint64_t MemcpySizeBits = LastFieldOffset + LastFieldSize -
953 FirstByteOffset + Ctx.getCharWidth() - 1;
966 if (FirstField->isBitField()) {
968 CGF.getTypes().getCGRecordLayout(FirstField->getParent());
1011 FirstFieldOffset = RecLayout.getFieldOffset(F->getFieldIndex());
1013 LastAddedFieldIndex = F->getFieldIndex();
1018 // F->getFieldIndex() == LastAddedFieldIndex + 1
1019 // The one exception is that Sema won't add a copy-initializer for an
1021 assert(F->getFieldIndex() >= LastAddedFieldIndex + 1 &&
1023 LastAddedFieldIndex = F->getFieldIndex();
1028 uint64_t FOffset = RecLayout.getFieldOffset(F->getFieldIndex());
1053 if (CD->isCopyOrMoveConstructor() && CD->isDefaulted())
1063 FieldDecl *Field = MemberInit->getMember();
1065 QualType FieldType = Field->getType();
1066 CXXConstructExpr *CE = dyn_cast<CXXConstructExpr>(MemberInit->getInit());
1068 // Bail out on non-memcpyable, not-trivially-copyable members.
1069 if (!(CE && isMemcpyEquivalentSpecialMember(CE->getConstructor())) &&
1071 FieldType->isReferenceType()))
1085 : FieldMemcpyizer(CGF, CD->getParent(), getTrivialCopySource(CGF, CD, Args)),
1087 MemcpyableCtor(CD->isDefaulted() &&
1088 CD->isCopyOrMoveConstructor() &&
1095 addMemcpyableField(MemberInit->getMember());
1098 EmitMemberInitializer(CGF, ConstructorDecl->getParent(), MemberInit,
1109 EmitMemberInitializer(CGF, ConstructorDecl->getParent(),
1129 QualType FieldType = MemberInit->getAnyMember()->getType();
1159 if (BO->getOpcode() != BO_Assign)
1161 MemberExpr *ME = dyn_cast<MemberExpr>(BO->getLHS());
1164 FieldDecl *Field = dyn_cast<FieldDecl>(ME->getMemberDecl());
1167 Stmt *RHS = BO->getRHS();
1169 RHS = EC->getSubExpr();
1173 if (ME2->getMemberDecl() == Field)
1178 CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(MCE->getCalleeDecl());
1181 MemberExpr *IOA = dyn_cast<MemberExpr>(MCE->getImplicitObjectArgument());
1184 FieldDecl *Field = dyn_cast<FieldDecl>(IOA->getMemberDecl());
1187 MemberExpr *Arg0 = dyn_cast<MemberExpr>(MCE->getArg(0));
1188 if (!Arg0 || Field != dyn_cast<FieldDecl>(Arg0->getMemberDecl()))
1192 FunctionDecl *FD = dyn_cast<FunctionDecl>(CE->getCalleeDecl());
1193 if (!FD || FD->getBuiltinID() != Builtin::BI__builtin_memcpy)
1195 Expr *DstPtr = CE->getArg(0);
1197 DstPtr = DC->getSubExpr();
1199 if (!DUO || DUO->getOpcode() != UO_AddrOf)
1201 MemberExpr *ME = dyn_cast<MemberExpr>(DUO->getSubExpr());
1204 FieldDecl *Field = dyn_cast<FieldDecl>(ME->getMemberDecl());
1207 Expr *SrcPtr = CE->getArg(1);
1209 SrcPtr = SC->getSubExpr();
1211 if (!SUO || SUO->getOpcode() != UO_AddrOf)
1213 MemberExpr *ME2 = dyn_cast<MemberExpr>(SUO->getSubExpr());
1214 if (!ME2 || Field != dyn_cast<FieldDecl>(ME2->getMemberDecl()))
1228 : FieldMemcpyizer(CGF, AD->getParent(), Args[Args.size() - 1]),
1264 const Type *BaseType = BaseInit->getBaseClass();
1266 cast<CXXRecordDecl>(BaseType->castAs<RecordType>()->getDecl());
1267 return BaseClassDecl->isDynamicClass();
1270 /// EmitCtorPrologue - This routine generates necessary code to initialize
1271 /// base classes and non-static data members belonging to this constructor.
1275 if (CD->isDelegatingConstructor())
1278 const CXXRecordDecl *ClassDecl = CD->getParent();
1280 CXXConstructorDecl::init_const_iterator B = CD->init_begin(),
1281 E = CD->init_end();
1284 // - This is a base ctor variant
1285 // - There are no vbases
1286 // - The class is abstract, so a complete object of it cannot be constructed
1291 ClassDecl->getNumVBases() != 0 &&
1292 !ClassDecl->isAbstract();
1305 for (; B != E && (*B)->isBaseInitializer() && (*B)->isBaseVirtual(); B++) {
1322 // Then, non-virtual base initializers.
1323 for (; B != E && (*B)->isBaseInitializer(); B++) {
1324 assert(!(*B)->isBaseVirtual());
1340 assert(!Member->isBaseInitializer());
1341 assert(Member->isAnyMemberInitializer() &&
1342 "Delegating initializer on non-delegating constructor");
1357 if (BaseClassDecl->hasTrivialDestructor())
1360 if (!BaseClassDecl->getDestructor()->hasTrivialBody())
1364 for (const auto *Field : BaseClassDecl->fields())
1368 // Check non-virtual bases.
1369 for (const auto &I : BaseClassDecl->bases()) {
1374 cast<CXXRecordDecl>(I.getType()->castAs<RecordType>()->getDecl());
1382 for (const auto &I : BaseClassDecl->vbases()) {
1384 cast<CXXRecordDecl>(I.getType()->castAs<RecordType>()->getDecl());
1398 QualType FieldBaseElementType = Context.getBaseElementType(Field->getType());
1400 const RecordType *RT = FieldBaseElementType->getAs<RecordType>();
1404 CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
1407 if (FieldClassDecl->isUnion() && FieldClassDecl->isAnonymousStructOrUnion())
1413 /// CanSkipVTablePointerInitialization - Check whether we need to initialize
1417 const CXXRecordDecl *ClassDecl = Dtor->getParent();
1418 if (!ClassDecl->isDynamicClass())
1423 if (ClassDecl->isEffectivelyFinal())
1426 if (!Dtor->hasTrivialBody())
1430 for (const auto *Field : ClassDecl->fields())
1437 /// EmitDestructorBody - Emits the body of the current destructor.
1442 // For an abstract class, non-base destructors are never used (and can't
1447 if (DtorType != Dtor_Base && Dtor->getParent()->isAbstract()) {
1449 TrapCall->setDoesNotReturn();
1450 TrapCall->setDoesNotThrow();
1456 Stmt *Body = Dtor->getBody();
1463 // outside of the function-try-block, which means it's always
1470 QualType ThisTy = Dtor->getFunctionObjectParameterType();
1477 // If the body is a function-try-block, enter the try before
1489 // this optimization if the body is a function-try-block, because
1498 "can't emit a dtor without a body for non-Microsoft ABIs");
1504 QualType ThisTy = Dtor->getFunctionObjectParameterType();
1516 // Enter the cleanup scopes for fields and non-virtual bases.
1526 InitializeVTablePointers(Dtor->getParent());
1530 EmitStmt(cast<CXXTryStmt>(Body)->getTryBlock());
1534 assert(Dtor->isImplicit() && "bodyless dtor not implicit");
1537 // -fapple-kext must inline any call to this dtor into
1540 CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
1555 const Stmt *RootS = AssignOp->getBody();
1560 LexicalScope Scope(*this, RootCS->getSourceRange());
1565 for (auto *I : RootCS->body())
1573 if (Expr *ThisArg = DD->getOperatorDeleteThisArg())
1584 const CXXRecordDecl *ClassDecl = Dtor->getParent();
1585 CGF.EmitDeleteCall(Dtor->getOperatorDelete(),
1602 const CXXRecordDecl *ClassDecl = Dtor->getParent();
1603 CGF.EmitDeleteCall(Dtor->getOperatorDelete(),
1606 assert(Dtor->getOperatorDelete()->isDestroyingOperatorDelete() ==
1646 QualType RecordTy = CGF.getContext().getTagDeclType(field->getParent());
1651 CGF.emitDestroy(LV.getAddress(), field->getType(), destroyer,
1666 InlinedAt = DI->getInlinedAt();
1667 DI->setInlinedAt(CGF.Builder.getCurrentDebugLocation());
1675 DI->setInlinedAt(InlinedAt);
1716 cast<CXXMethodDecl>(CGF.CurCodeDecl)->getParent();
1735 CGF.CurFn->addFnAttr("disable-tail-calls", "true");
1755 Context.getASTRecordLayout(Dtor->getParent());
1760 Layout.getFieldOffset(StartIndex) + Context.getCharWidth() - 1);
1774 CharUnits PoisonSize = PoisonEnd - PoisonStart;
1780 CGF, **std::next(Dtor->getParent()->field_begin(), StartIndex));
1784 CGF.CurFn->addFnAttr("disable-tail-calls", "true");
1796 assert(Dtor->getParent()->isDynamicClass());
1821 unsigned FieldIndex = Field->getFieldIndex();
1834 *StartIndex, -1);
1847 assert((!DD->isTrivial() || DD->hasAttr<DLLExportAttr>()) &&
1848 "Should not emit dtor epilogue for non-exported trivial dtor!");
1850 // The deleting-destructor phase just needs to call the appropriate
1853 assert(DD->getOperatorDelete() &&
1854 "operator delete missing - EnterDtorCleanups");
1858 if (DD->getOperatorDelete()->isDestroyingOperatorDelete())
1865 if (DD->getOperatorDelete()->isDestroyingOperatorDelete()) {
1866 const CXXRecordDecl *ClassDecl = DD->getParent();
1867 EmitDeleteCall(DD->getOperatorDelete(),
1878 const CXXRecordDecl *ClassDecl = DD->getParent();
1881 if (ClassDecl->isUnion())
1884 // The complete-destructor phase just destructs all the virtual bases.
1889 SanOpts.has(SanitizerKind::Memory) && ClassDecl->getNumVBases() &&
1890 ClassDecl->isPolymorphic())
1895 for (const auto &Base : ClassDecl->vbases()) {
1897 cast<CXXRecordDecl>(Base.getType()->castAs<RecordType>()->getDecl());
1899 if (BaseClassDecl->hasTrivialDestructor()) {
1901 // memory. For non-trival base classes the same is done in the class
1904 SanOpts.has(SanitizerKind::Memory) && !BaseClassDecl->isEmpty())
1921 SanOpts.has(SanitizerKind::Memory) && !ClassDecl->getNumVBases() &&
1922 ClassDecl->isPolymorphic())
1925 // Destroy non-virtual bases.
1926 for (const auto &Base : ClassDecl->bases()) {
1931 CXXRecordDecl *BaseClassDecl = Base.getType()->getAsCXXRecordDecl();
1933 if (BaseClassDecl->hasTrivialDestructor()) {
1935 SanOpts.has(SanitizerKind::Memory) && !BaseClassDecl->isEmpty())
1952 for (const auto *Field : ClassDecl->fields()) {
1956 QualType type = Field->getType();
1962 const RecordType *RT = type->getAsUnionType();
1963 if (RT && RT->getDecl()->isAnonymousStructOrUnion())
1975 /// EmitCXXAggrConstructorCall - Emit a loop to call a particular
1982 /// zero-initialized before it is constructed
1995 /// EmitCXXAggrConstructorCall - Emit a loop to call a particular
2003 /// zero-initialized before it is constructed
2011 // dynamically, because x can be zero in 'new A[x]', and statically,
2012 // because of GCC extensions that permit zero-length arrays. There
2022 if (constantCount->isZero()) return;
2042 llvm::PHINode *cur = Builder.CreatePHI(arrayBegin->getType(), 2,
2044 cur->addIncoming(arrayBegin, entryBB);
2053 // use the non-virtual size or alignment.
2054 QualType type = getContext().getTypeDeclType(ctor->getParent());
2066 // point than the end of the full-expression. The first context is when a
2076 // partial-destroy cleanup.
2078 !ctor->getParent()->hasTrivialDestructor()) {
2096 cur->addIncoming(next, Builder.GetInsertBlock());
2104 if (zeroCheckBranch) zeroCheckBranch->setSuccessor(0, contBB);
2112 const RecordType *rtype = type->castAs<RecordType>();
2113 const CXXRecordDecl *record = cast<CXXRecordDecl>(rtype->getDecl());
2114 const CXXDestructorDecl *dtor = record->getDestructor();
2115 assert(!dtor->isTrivial());
2129 LangAS ThisAS = D->getFunctionObjectParameterType().getAddressSpace();
2131 getAsNaturalPointerTo(This, D->getThisType()->getPointeeType());
2142 Args.add(RValue::get(ThisPtr), D->getThisType());
2148 assert(E->getNumArgs() == 1 && "unexpected argcount for trivial ctor");
2150 const Expr *Arg = E->getArg(0);
2152 QualType DestTy = getContext().getTypeDeclType(D->getParent());
2158 // Add the rest of the user-supplied arguments.
2159 const FunctionProtoType *FPT = D->getType()->castAs<FunctionProtoType>();
2160 EvaluationOrder Order = E->isListInitialization()
2163 EmitCallArgs(Args, FPT, E->arguments(), E->getConstructor(),
2167 ThisAVS.mayOverlap(), E->getExprLoc(),
2175 if (Ctor->isVariadic())
2179 // If the parameters are callee-cleanup, it's not safe to forward.
2180 for (auto *P : Ctor->parameters())
2181 if (P->needsDestruction(CGF.getContext()))
2204 const CXXRecordDecl *ClassDecl = D->getParent();
2210 if (D->isTrivial() && D->isDefaultConstructor()) {
2220 QualType SrcTy = D->getParamDecl(0)->getType().getNonReferenceType();
2232 if (auto Inherited = D->getInheritedConstructor()) {
2241 // Insert any ABI-specific implicit constructor arguments.
2258 // - Otherwise we can refer to vtable if it's safe to speculatively emit.
2263 // assumes. Make assumption loads require -fstrict-vtable-pointers temporarily.
2265 ClassDecl->isDynamicClass() && Type != Ctor_Base &&
2276 This, D->getThisType()->getPointeeType())),
2277 D->getThisType());
2289 assert(CXXInheritedCtorInitExprArgs.size() >= D->getNumParams() &&
2297 assert(OuterCtor->getNumParams() == D->getNumParams());
2298 assert(!OuterCtor->isVariadic() && "should have been inlined");
2300 for (const auto *Param : OuterCtor->parameters()) {
2302 OuterCtor->getParamDecl(Param->getFunctionScopeIndex())->getType(),
2303 Param->getType()));
2304 EmitDelegateCallArg(Args, Param, E->getLocation());
2307 if (Param->hasAttr<PassObjectSizeAttr>()) {
2310 EmitDelegateCallArg(Args, POSParam, E->getLocation());
2317 E->getLocation(), /*NewPointerIsChecked*/true);
2335 // Insert any ABI-specific implicit constructor arguments.
2355 if (!RetType->isVoidType())
2380 GetVTablePtr(This, VTableGlobal->getType(), Vptr.VTableClass);
2397 const FunctionProtoType *FPT = D->getType()->castAs<FunctionProtoType>();
2402 Args.add(RValue::get(getAsNaturalPointerTo(This, D->getThisType())),
2403 D->getThisType());
2406 QualType QT = *(FPT->param_type_begin());
2408 llvm::Value *Val = getAsNaturalPointerTo(Src, D->getThisType());
2413 EmitCallArgs(Args, FPT, drop_begin(E->arguments(), 1), E->getConstructor(),
2418 AggValueSlot::MayOverlap, E->getExprLoc(),
2435 This, (*I)->getType()->getPointeeType())),
2436 (*I)->getType());
2443 assert((*I)->getType()->isPointerType() &&
2451 // FIXME: per-argument source location
2474 QualType ThisTy = Dtor->getFunctionObjectParameterType();
2484 assert(Ctor->isDelegatingConstructor());
2498 EmitAggExpr(Ctor->init_begin()[0]->getInit(), AggSlot);
2500 const CXXRecordDecl *ClassDecl = Ctor->getParent();
2501 if (CGM.getLangOpts().Exceptions && !ClassDecl->hasTrivialDestructor()) {
2506 ClassDecl->getDestructor(),
2543 CXXRecordDecl *ClassDecl = T->getAsCXXRecordDecl();
2545 if (ClassDecl->hasTrivialDestructor()) return;
2547 const CXXDestructorDecl *D = ClassDecl->getDestructor();
2548 assert(D && D->isUsed() && "destructor not marked as used!");
2624 // If this base is a non-virtual primary base the address point has already
2635 for (const auto &I : RD->bases()) {
2637 cast<CXXRecordDecl>(I.getType()->castAs<RecordType>()->getDecl());
2640 if (!BaseDecl->isDynamicClass())
2676 if (!RD->isDynamicClass())
2684 if (RD->getNumVBases())
2726 // If a class has a single non-virtual base and does not introduce or override
2734 // we allow it by default. It can be disabled with -fsanitize=cfi-cast-strict.
2737 if (!RD->field_empty())
2740 if (RD->getNumVBases() != 0)
2743 if (RD->getNumBases() != 1)
2746 for (const CXXMethodDecl *MD : RD->methods()) {
2747 if (MD->isVirtual()) {
2751 if (isa<CXXDestructorDecl>(MD) && MD->isImplicit())
2758 RD->bases_begin()->getType()->getAsCXXRecordDecl());
2770 QualType Ty = QualType(RD->getTypeForDecl(), 0);
2805 auto *ClassTy = T->getAs<RecordType>();
2809 const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(ClassTy->getDecl());
2811 if (!ClassDecl->isCompleteDefinition() || !ClassDecl->isDynamicClass())
2876 std::string TypeName = RD->getQualifiedNameAsString();
2884 CGM.CreateMetadataIdentifierForType(QualType(RD->getTypeForDecl(), 0));
2893 EmitCheckTypeDescriptor(QualType(RD->getTypeForDecl(), 0)),
2909 llvm::MDString::get(CGM.getLLVMContext(), "all-vtables"));
2928 std::string TypeName = RD->getQualifiedNameAsString();
2941 CGM.CreateMetadataIdentifierForType(QualType(RD->getTypeForDecl(), 0));
2949 std::string TypeName = RD->getQualifiedNameAsString();
2975 callOperator->getType()->castAs<FunctionProtoType>();
2976 QualType resultType = FPT->getReturnType();
2978 if (!resultType->isVoidType() &&
2979 calleeFnInfo->getReturnInfo().getKind() == ABIArgInfo::Indirect &&
2980 !hasScalarEvaluationKind(calleeFnInfo->getReturnType()))
2986 // the call can't be variadic anyway --- it's impossible to forward
2994 if (!resultType->isVoidType() && returnSlot.isNull()) {
2995 if (getLangOpts().ObjCAutoRefCount && resultType->isObjCRetainableType()) {
3004 const BlockDecl *BD = BlockInfo->getBlockDecl();
3005 const VarDecl *variable = BD->capture_begin()->getVariable();
3006 const CXXRecordDecl *Lambda = variable->getType()->getAsCXXRecordDecl();
3007 const CXXMethodDecl *CallOp = Lambda->getLambdaCallOperator();
3009 if (CallOp->isVariadic()) {
3025 for (auto *param : BD->parameters())
3026 EmitDelegateCallArg(CallArgs, param, param->getBeginLoc());
3028 assert(!Lambda->isGenericLambda() &&
3034 if (MD->isVariadic()) {
3042 const CXXRecordDecl *Lambda = MD->getParent();
3058 for (auto *Param : MD->parameters())
3059 EmitDelegateCallArg(CallArgs, Param, Param->getBeginLoc());
3061 const CXXRecordDecl *Lambda = MD->getParent();
3062 const CXXMethodDecl *CallOp = Lambda->getLambdaCallOperator();
3064 // to which the call to the static-invoker shall be forwarded.
3065 if (Lambda->isGenericLambda()) {
3066 assert(MD->isFunctionTemplateSpecialization());
3067 const TemplateArgumentList *TAL = MD->getTemplateSpecializationArgs();
3068 FunctionTemplateDecl *CallOpTemplate = CallOp->getDescribedFunctionTemplate();
3071 CallOpTemplate->findSpecialization(TAL->asArray(), InsertPos);
3090 if (MD->isVariadic()) {
3099 QualType LambdaType = getContext().getRecordType(MD->getParent());
3101 llvm::Value *ThisArg = CurFn->getArg(0);
3119 ArgTypes.push_back(I->type);
3129 StringRef CallOpName = CallOpFn->getName();
3136 llvm::Function *Fn = CallOpFn->getParent()->getFunction(ImplName);