Lines Matching full:entity
210 /// handle the initialization of a certain kind of entity, e.g.,
242 void CheckImplicitInitList(const InitializedEntity &Entity,
246 void CheckExplicitInitList(const InitializedEntity &Entity,
250 void CheckListElementTypes(const InitializedEntity &Entity,
257 void CheckSubElementType(const InitializedEntity &Entity,
262 void CheckComplexType(const InitializedEntity &Entity,
267 void CheckScalarType(const InitializedEntity &Entity,
272 void CheckReferenceType(const InitializedEntity &Entity,
277 void CheckVectorType(const InitializedEntity &Entity,
281 void CheckStructUnionTypes(const InitializedEntity &Entity,
288 void CheckArrayType(const InitializedEntity &Entity,
294 bool CheckDesignatedInitializer(const InitializedEntity &Entity,
318 const InitializedEntity &Entity,
323 void FillInEmptyInitializations(const InitializedEntity &Entity,
325 bool CheckFlexibleArrayInit(const InitializedEntity &Entity,
328 void CheckEmptyInitializable(const InitializedEntity &Entity,
332 InitListChecker(Sema &S, const InitializedEntity &Entity,
344 const InitializedEntity &Entity,
357 Entity.getType()->getBaseElementTypeUnsafe()->isRecordType();
379 InitializationSequence InitSeq(SemaRef, Entity, Kind, SubInit);
415 SemaRef, Entity,
423 SemaRef.Diag(Entity.getDecl()->getLocation(),
431 InitSeq.Diagnose(SemaRef, Entity, Kind, SubInit);
432 if (Entity.getKind() == InitializedEntity::EK_Member)
433 SemaRef.Diag(Entity.getDecl()->getLocation(),
435 << /*field*/1 << Entity.getDecl();
436 else if (Entity.getKind() == InitializedEntity::EK_ArrayElement)
438 << /*array element*/0 << Entity.getElementIndex();
444 : InitSeq.Perform(SemaRef, Entity, Kind, SubInit);
447 void InitListChecker::CheckEmptyInitializable(const InitializedEntity &Entity,
451 if (PerformEmptyInit(SemaRef, Loc, Entity, /*VerifyOnly*/true).isInvalid())
526 InitListChecker::FillInEmptyInitializations(const InitializedEntity &Entity,
536 Entity, ILE, RequiresSecondPass);
541 FillInEmptyInitForField(0, Field, Entity, ILE, RequiresSecondPass);
554 FillInEmptyInitForField(Init, Field, Entity, ILE, RequiresSecondPass);
571 InitializedEntity ElementEntity = Entity;
579 0, Entity);
584 0, Entity);
639 InitListChecker::InitListChecker(Sema &S, const InitializedEntity &Entity,
650 CheckExplicitInitList(Entity, IL, T, FullyStructuredList,
655 FillInEmptyInitializations(Entity, FullyStructuredList, RequiresSecondPass);
657 FillInEmptyInitializations(Entity, FullyStructuredList,
690 void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity,
725 CheckListElementTypes(Entity, ParentIList, T,
757 /// Warn that \p Entity was of scalar type and was initialized by a
759 static void warnBracedScalarInit(Sema &S, const InitializedEntity &Entity,
769 switch (Entity.getKind()) {
783 if (Entity.getParent())
824 void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity,
834 CheckListElementTypes(Entity, IList, T, /*SubobjectIsDesignatorContext=*/true,
896 warnBracedScalarInit(SemaRef, Entity, IList->getSourceRange());
899 void InitListChecker::CheckListElementTypes(const InitializedEntity &Entity,
910 CheckComplexType(Entity, IList, DeclType, Index,
913 CheckScalarType(Entity, IList, DeclType, Index,
916 CheckVectorType(Entity, IList, DeclType, Index,
922 CheckStructUnionTypes(Entity, IList, DeclType, RD->field_begin(),
930 CheckArrayType(Entity, IList, DeclType, Zero,
941 CheckReferenceType(Entity, IList, DeclType, Index,
956 void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
965 return CheckReferenceType(Entity, IList, ElemType, Index,
974 CheckExplicitInitList(Entity, SubInitList, ElemType,
1000 InitializationSequence Seq(SemaRef, Entity, Kind, expr,
1012 Seq.Perform(SemaRef, Entity, Kind, expr);
1027 return CheckScalarType(Entity, IList, ElemType, Index,
1085 CheckImplicitInitList(Entity, IList, ElemType, Index, StructuredList,
1092 SemaRef.PerformCopyInitialization(Entity, SourceLocation(), expr,
1101 void InitListChecker::CheckComplexType(const InitializedEntity &Entity,
1116 return CheckScalarType(Entity, IList, DeclType, Index, StructuredList,
1128 InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity);
1138 void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
1165 CheckScalarType(Entity, SubIList, DeclType, Index, StructuredList,
1180 if (!SemaRef.CanPerformCopyInitialization(Entity,expr))
1187 SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr,
1209 void InitListChecker::CheckReferenceType(const InitializedEntity &Entity,
1242 if (!SemaRef.CanPerformCopyInitialization(Entity,expr))
1249 SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr,
1265 void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
1279 InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity),
1290 if (!SemaRef.CanPerformCopyInitialization(Entity, Init))
1297 SemaRef.PerformCopyInitialization(Entity, Init->getLocStart(), Init,
1321 InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity);
1340 const VectorType *T = Entity.getType()->getAs<VectorType>();
1379 InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity);
1420 void InitListChecker::CheckArrayType(const InitializedEntity &Entity,
1485 if (CheckDesignatedInitializer(Entity, IList, DIE, 0,
1514 Entity);
1545 SemaRef.Context, 0, Entity),
1550 bool InitListChecker::CheckFlexibleArrayInit(const InitializedEntity &Entity,
1567 } else if (Entity.getKind() != InitializedEntity::EK_Variable) {
1570 } else if (cast<VarDecl>(Entity.getDecl())->hasLocalStorage()) {
1589 void InitListChecker::CheckStructUnionTypes(const InitializedEntity &Entity,
1633 InitializedEntity::InitializeMember(*Field, &Entity),
1663 if (CheckDesignatedInitializer(Entity, IList, DIE, 0,
1711 InitializedEntity::InitializeMember(*Field, &Entity);
1747 InitializedEntity::InitializeMember(*Field, &Entity),
1756 if (CheckFlexibleArrayInit(Entity, IList->getInit(Index), *Field,
1764 InitializedEntity::InitializeMember(*Field, &Entity);
1874 InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
1896 CheckSubElementType(Entity, IList, CurrentObjectType, Index,
2099 if (!Invalid && CheckFlexibleArrayInit(Entity, DIE->getInit(), *Field,
2115 InitializedEntity::InitializeMember(*Field, &Entity);
2134 InitializedEntity::InitializeMember(*Field, &Entity);
2166 CheckStructUnionTypes(Entity, IList, CurrentObjectType, Field, false, Index,
2323 InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity);
2357 CheckArrayType(Entity, IList, CurrentObjectType, DesignatedStartIndex,
2608 // Initialization entity
3106 const InitializedEntity &Entity) {
3111 if (Entity.isParameterKind()) {
3112 if (!Entity.isParameterConsumed())
3115 assert(Entity.getType()->isObjCRetainableType() &&
3117 Sequence.AddProduceObjCObjectStep(Entity.getType());
3123 } else if (Entity.getKind() == InitializedEntity::EK_Result) {
3124 if (!Entity.getType()->isObjCRetainableType())
3127 Sequence.AddProduceObjCObjectStep(Entity.getType());
3132 const InitializedEntity &Entity,
3243 /// enumerates the constructors of the initialized entity and performs overload
3248 /// type as the entity?
3250 const InitializedEntity &Entity,
3340 Entity.getType().isConstQualified() &&
3392 const InitializedEntity &Entity,
3402 const InitializedEntity &Entity,
3409 const InitializedEntity &Entity,
3419 QualType DestType = Entity.getType();
3448 TryReferenceInitializationCore(S, Entity, Kind, Initializer, cv1T1, T1,
3476 const InitializedEntity &Entity,
3480 QualType DestType = Entity.getType();
3490 TryReferenceListInitialization(S, Entity, Kind, InitList, Sequence);
3517 TryConstructorInitialization(S, Entity, Kind, InitAsExpr, DestType,
3533 Sequence.InitializeFrom(S, Entity, SubKind, SubInit,
3540 Sequence.RewrapReferenceInitList(Entity.getType(), InitList);
3557 TryValueInitialization(S, Entity, Kind, Sequence, InitList);
3569 TryConstructorInitialization(S, Entity, Kind, InitListAsExpr, DestType,
3599 Sequence.InitializeFrom(S, Entity, SubKind, SubInit,
3602 Sequence.RewrapReferenceInitList(Entity.getType(), InitList);
3606 InitListChecker CheckInitList(S, Entity, InitList,
3620 const InitializedEntity &Entity,
3625 QualType DestType = Entity.getType();
3803 const InitializedEntity &Entity,
3808 const InitializedEntity &Entity,
3812 QualType DestType = Entity.getType();
3828 TryReferenceInitializationCore(S, Entity, Kind, Initializer, cv1T1, T1,
3885 const InitializedEntity &Entity,
3893 QualType DestType = Entity.getType();
3957 S, Entity, Kind, Initializer, /*AllowRValues*/isRValueRef, Sequence);
4012 CheckCXX98CompatAccessibleCopy(S, Entity, Initializer);
4040 S, Entity, Kind, Initializer, /*AllowRValues*/true, Sequence);
4123 const InitializedEntity &Entity,
4127 Sequence.AddStringInitStep(Entity.getType());
4132 const InitializedEntity &Entity,
4142 QualType T = Entity.getType();
4175 Sequence.AddZeroInitializationStep(Entity.getType());
4182 // entity of reference type is ill-formed.
4200 return TryConstructorInitialization(S, Entity, Kind, Args, T, Sequence,
4205 Sequence.AddZeroInitializationStep(Entity.getType());
4210 const InitializedEntity &Entity,
4218 QualType DestType = S.Context.getBaseElementType(Entity.getType());
4224 TryConstructorInitialization(S, Entity, Kind, None, DestType, Sequence);
4240 Sequence.AddZeroInitializationStep(Entity.getType());
4414 const InitializedEntity &Entity,
4417 Entity.getKind() == InitializedEntity::EK_Result &&
4418 Entity.getType()->isPointerType() &&
4531 const InitializedEntity &Entity,
4544 if (!S.isObjCWritebackConversion(ArgType, Entity.getType(),
4551 if (ParmVarDecl *param = cast_or_null<ParmVarDecl>(Entity.getDecl()))
4572 Sequence.AddPassByIndirectCopyRestoreStep(Entity.getType(), ShouldCopy);
4610 const InitializedEntity &Entity,
4615 InitializeFrom(S, Entity, Kind, Args, TopLevelOfInitList);
4619 const InitializedEntity &Entity,
4646 QualType DestType = Entity.getType();
4676 TryListInitialization(S, Entity, Kind, InitList, *this);
4691 TryReferenceInitialization(S, Entity, Kind, Args[0], *this);
4698 TryValueInitialization(S, Entity, Kind, *this);
4704 TryDefaultInitialization(S, Entity, Kind, *this);
4722 TryStringLiteralInitialization(S, Entity, Kind, Initializer, *this);
4757 Entity.getKind() == InitializedEntity::EK_Member &&
4759 TryListInitialization(S, Entity, Kind, cast<InitListExpr>(Initializer),
4775 Entity.isParameterKind();
4782 tryObjCWritebackConversion(S, *this, Entity, Initializer)) {
4794 MaybeProduceObjCObject(S, *this, Entity);
4810 TryConstructorInitialization(S, Entity, Kind, Args,
4846 MaybeProduceObjCObject(S, *this, Entity);
4848 AddAtomicConversionStep(Entity.getType());
4873 if (ParmVarDecl *Param = cast_or_null<ParmVarDecl>(Entity.getDecl()))
4890 if (isLibstdcxxPointerReturnFalseHack(S, Entity, Initializer)) {
4891 AddZeroInitializationStep(Entity.getType());
4901 MaybeProduceObjCObject(S, *this, Entity);
4916 getAssignmentAction(const InitializedEntity &Entity, bool Diagnose = false) {
4917 switch(Entity.getKind()) {
4926 if (Entity.getDecl() &&
4927 isa<ObjCMethodDecl>(Entity.getDecl()->getDeclContext()))
4933 if (Entity.getDecl() &&
4934 isa<ObjCMethodDecl>(Entity.getDecl()->getDeclContext()))
4961 /// initializing the given entity.
4962 static bool shouldBindAsTemporary(const InitializedEntity &Entity) {
4963 switch (Entity.getKind()) {
4989 /// \brief Whether the given entity, when initialized with an object
4991 static bool shouldDestroyTemporary(const InitializedEntity &Entity) {
4992 switch (Entity.getKind()) {
5068 static SourceLocation getInitializationLoc(const InitializedEntity &Entity,
5070 switch (Entity.getKind()) {
5072 return Entity.getReturnLoc();
5075 return Entity.getThrowLoc();
5078 return Entity.getDecl()->getLocation();
5081 return Entity.getCaptureLoc();
5110 /// \param Entity The entity being initialized.
5123 const InitializedEntity &Entity,
5152 SourceLocation Loc = getInitializationLoc(Entity, CurInit.get());
5176 << (int)Entity.getKind() << CurInitExpr->getType()
5185 << (int)Entity.getKind() << CurInitExpr->getType()
5192 << (int)Entity.getKind() << CurInitExpr->getType()
5202 S.CheckConstructorAccess(Loc, Constructor, Entity,
5248 if (!CurInit.isInvalid() && shouldBindAsTemporary(Entity))
5257 const InitializedEntity &Entity,
5265 SourceLocation Loc = getInitializationLoc(Entity, CurInitExpr);
5279 << OR << (int)Entity.getKind() << CurInitExpr->getType()
5285 Entity, Best->FoundDecl.getAccess(), Diag);
5307 const InitializedEntity &Entity) {
5308 if (Entity.isParameterKind() && Entity.getDecl()) {
5309 if (Entity.getDecl()->getLocation().isInvalid())
5312 if (Entity.getDecl()->getDeclName())
5313 S.Diag(Entity.getDecl()->getLocation(), diag::note_parameter_named_here)
5314 << Entity.getDecl()->getDeclName();
5316 S.Diag(Entity.getDecl()->getLocation(), diag::note_parameter_here);
5318 else if (Entity.getKind() == InitializedEntity::EK_RelatedResult &&
5319 Entity.getMethodDecl())
5320 S.Diag(Entity.getMethodDecl()->getLocation(),
5322 << Entity.getMethodDecl()->getDeclName();
5332 static bool isExplicitTemporary(const InitializedEntity &Entity,
5335 switch (Entity.getKind()) {
5358 const InitializedEntity &Entity,
5409 if (isExplicitTemporary(Entity, Kind, NumArgs)) {
5415 TypeSourceInfo *TSInfo = Entity.getTypeSourceInfo();
5417 TSInfo = S.Context.getTrivialTypeSourceInfo(Entity.getType(), Loc);
5431 if (Entity.getKind() == InitializedEntity::EK_Base) {
5432 ConstructKind = Entity.getBaseSpecifier()->isVirtual() ?
5435 } else if (Entity.getKind() == InitializedEntity::EK_Delegating) {
5447 // If the entity allows NRVO, mark the construction as elidable
5449 if (Entity.allowsNRVO())
5450 CurInit = S.BuildCXXConstructExpr(Loc, Entity.getType(),
5460 CurInit = S.BuildCXXConstructExpr(Loc, Entity.getType(),
5474 S.CheckConstructorAccess(Loc, Constructor, Entity,
5479 if (shouldBindAsTemporary(Entity))
5489 InitializedEntityOutlivesFullExpression(const InitializedEntity &Entity) {
5490 const InitializedEntity *Top = &Entity;
5518 // The entity being initialized might not outlive the full-expression.
5522 llvm_unreachable("unknown entity kind");
5525 /// Determine the declaration which an initialized entity ultimately refers to,
5527 /// the initialization of \p Entity.
5529 const InitializedEntity *Entity,
5532 switch (Entity->getKind()) {
5535 return Entity;
5539 if (Entity->getParent())
5540 return getEntityForTemporaryLifetimeExtension(Entity->getParent(),
5541 Entity);
5546 return Entity;
5573 return getEntityForTemporaryLifetimeExtension(Entity->getParent(),
5591 llvm_unreachable("unknown entity kind");
5703 static void warnOnLifetimeExtension(Sema &S, const InitializedEntity &Entity,
5715 for (const InitializedEntity *Ent = Entity.getParent(); Ent;
5744 const InitializedEntity &Entity,
5749 Diagnose(S, Entity, Kind, Args);
5757 if (ResultType && !Entity.getType()->isDependentType() &&
5759 QualType DeclType = Entity.getType();
5772 // Scavange the location of the brackets from the entity, if we can.
5773 if (DeclaratorDecl *DD = Entity.getDecl()) {
5809 if (S.getLangOpts().CPlusPlus11 && Entity.getType()->isReferenceType() &&
5811 !Entity.isParameterKind()) {
5823 Entity.getType()->isPointerType() &&
5824 InitializedEntityOutlivesFullExpression(Entity)) {
5832 QualType DestType = Entity.getType().getNonReferenceType();
5833 // FIXME: Ugly hack around the fact that Entity.getType() is not
5834 // the same as Entity.getDecl()->getType() in cases involving type merging,
5837 *ResultType = Entity.getDecl() ? Entity.getDecl()->getType() :
5838 Entity.getType();
5944 << Entity.getType().isVolatileQualified()
5957 << Entity.getType().isVolatileQualified()
5959 PrintInitLocationNote(S, Entity);
5973 getEntityForTemporaryLifetimeExtension(&Entity))
5975 warnOnLifetimeExtension(S, Entity, CurInit.get(),
5991 Entity.getType().getNonReferenceType(), CurInit.get(),
5992 Entity.getType()->isLValueReferenceType());
5995 // entity's lifetime.
5997 getEntityForTemporaryLifetimeExtension(&Entity))
5999 warnOnLifetimeExtension(S, Entity, CurInit.get(), /*IsInitializerList=*/false,
6017 CurInit = CopyObject(S, Step->Type, Entity, CurInit,
6056 S.CheckConstructorAccess(Kind.getLocation(), Constructor, Entity,
6099 Entity);
6101 if (!MaybeBindToTemp && CreatedObject && shouldDestroyTemporary(Entity)) {
6120 CurInit = CopyObject(S, Entity.getType().getNonReferenceType(), Entity,
6163 getAssignmentAction(Entity), CCK);
6170 DiagnoseNarrowingInInitList(S, *Step->ICS, SourceType, Entity.getType(),
6177 // If we're not initializing the top-level entity, we need to create an
6178 // InitializeTemporary entity for our target type.
6180 bool IsTemporary = !S.Context.hasSameType(Entity.getType(), Ty);
6182 InitializedEntity InitEntity = IsTemporary ? TempEntity : Entity;
6212 // to object", we don't get an EK_Temporary entity, but instead an
6213 // EK_Parameter entity with reference type.
6218 Entity.getType().getNonReferenceType());
6219 bool UseTemporary = Entity.getType()->isReferenceType();
6226 Entity,
6255 // to object", we don't get an EK_Temporary entity, but instead an
6256 // EK_Parameter entity with reference type.
6261 Entity.getType().getNonReferenceType());
6262 bool UseTemporary = Entity.getType()->isReferenceType();
6266 S, UseTemporary ? TempEntity : Entity, Kind, Args, *Step,
6287 TypeSourceInfo *TSInfo = Entity.getTypeSourceInfo();
6306 Entity.getKind() == InitializedEntity::EK_Parameter_CF_Audited);
6314 Entity.isParameterKind() &&
6326 getAssignmentAction(Entity, true),
6328 PrintInitLocationNote(S, Entity);
6331 PrintInitLocationNote(S, Entity);
6403 // entity's lifetime.
6405 getEntityForTemporaryLifetimeExtension(&Entity))
6407 warnOnLifetimeExtension(S, Entity, CurInit.get(),
6416 if (shouldBindAsTemporary(Entity))
6427 if (Entity.isParameterKind()) {
6431 } else if (Entity.getKind() != InitializedEntity::EK_Variable) {
6450 if (Entity.getKind() == InitializedEntity::EK_Member &&
6451 cast<FieldDecl>(Entity.getDecl())->isBitField())
6453 cast<FieldDecl>(Entity.getDecl()),
6500 static void emitBadConversionNotes(Sema &S, const InitializedEntity &entity,
6502 QualType destType = entity.getType();
6512 if (entity.getKind() == InitializedEntity::EK_Result)
6517 static void diagnoseListInit(Sema &S, const InitializedEntity &Entity,
6519 QualType DestType = Entity.getType();
6540 if (auto *D = Entity.getDecl())
6546 InitListChecker DiagnoseInitList(S, Entity, InitList, DestType,
6552 /// Prints a fixit for adding a null initializer for |Entity|. Call this only
6556 const InitializedEntity &Entity) {
6557 if (Entity.getKind() != InitializedEntity::EK_Variable)
6560 VarDecl *VD = cast<VarDecl>(Entity.getDecl());
6573 const InitializedEntity &Entity,
6579 QualType DestType = Entity.getType();
6582 // FIXME: Customize for the initialized entity?
6732 emitBadConversionNotes(S, Entity, Args[0]);
6738 << (int)Entity.getKind()
6745 emitBadConversionNotes(S, Entity, Args[0]);
6796 // FIXME: Using "DestType" for the entity we're printing is probably
6807 (Entity.getKind() == InitializedEntity::EK_Base ||
6808 Entity.getKind() == InitializedEntity::EK_Member) &&
6816 if (Entity.getKind() == InitializedEntity::EK_Base) {
6822 << Entity.getType();
6825 = Entity.getBaseSpecifier()->getType()->getAs<RecordType>()
6835 << Entity.getName();
6836 S.Diag(Entity.getDecl()->getLocation(),
6840 = Entity.getType()->getAs<RecordType>())
6886 if (Entity.getKind() == InitializedEntity::EK_Member &&
6897 << Entity.getName();
6898 S.Diag(Entity.getDecl()->getLocation(), diag::note_previous_decl)
6899 << Entity.getName();
6903 maybeEmitZeroInitializationFixit(S, *this, Entity);
6915 Entity, InitList);
6938 PrintInitLocationNote(S, Entity);
7326 Sema::CanPerformCopyInitialization(const InitializedEntity &Entity,
7336 InitializationSequence Seq(*this, Entity, Kind, InitE);
7341 Sema::PerformCopyInitialization(const InitializedEntity &Entity,
7358 InitializationSequence Seq(*this, Entity, Kind, InitE, TopLevelOfInitList);
7360 ExprResult Result = Seq.Perform(*this, Entity, Kind, InitE);