Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lib/Sema/SemaInit.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 6,429 Lines • ▼ Show 20 Lines | case SK_BindReference: | ||||
if (const InitializedEntity *ExtendingEntity = | if (const InitializedEntity *ExtendingEntity = | ||||
getEntityForTemporaryLifetimeExtension(&Entity)) | getEntityForTemporaryLifetimeExtension(&Entity)) | ||||
if (performReferenceExtension(CurInit.get(), ExtendingEntity)) | if (performReferenceExtension(CurInit.get(), ExtendingEntity)) | ||||
warnOnLifetimeExtension(S, Entity, CurInit.get(), | warnOnLifetimeExtension(S, Entity, CurInit.get(), | ||||
/*IsInitializerList=*/false, | /*IsInitializerList=*/false, | ||||
ExtendingEntity->getDecl()); | ExtendingEntity->getDecl()); | ||||
CheckForNullPointerDereference(S, CurInit.get()); | CheckForNullPointerDereference(S, CurInit.get()); | ||||
S.RefersToMemberWithReducedAlignment(CurInit.get(), [&](Expr *E, | |||||
RecordDecl *RD, | |||||
ValueDecl *MD, | |||||
CharUnits) { | |||||
S.Diag(Kind.getLocation(), diag::err_binding_reference_to_packed_member) | |||||
<< MD << RD << E->getSourceRange(); | |||||
}); | |||||
break; | break; | ||||
case SK_BindReferenceToTemporary: { | case SK_BindReferenceToTemporary: { | ||||
// Make sure the "temporary" is actually an rvalue. | // Make sure the "temporary" is actually an rvalue. | ||||
assert(CurInit.get()->isRValue() && "not a temporary"); | assert(CurInit.get()->isRValue() && "not a temporary"); | ||||
// Check exception specifications | // Check exception specifications | ||||
if (S.CheckExceptionSpecCompatibility(CurInit.get(), DestType)) | if (S.CheckExceptionSpecCompatibility(CurInit.get(), DestType)) | ||||
▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | case SK_ConversionSequenceNoNarrowing: { | ||||
: Kind.isFunctionalCast()? Sema::CCK_FunctionalCast | : Kind.isFunctionalCast()? Sema::CCK_FunctionalCast | ||||
: Kind.isExplicitCast()? Sema::CCK_OtherCast | : Kind.isExplicitCast()? Sema::CCK_OtherCast | ||||
: Sema::CCK_ImplicitConversion; | : Sema::CCK_ImplicitConversion; | ||||
ExprResult CurInitExprRes = | ExprResult CurInitExprRes = | ||||
S.PerformImplicitConversion(CurInit.get(), Step->Type, *Step->ICS, | S.PerformImplicitConversion(CurInit.get(), Step->Type, *Step->ICS, | ||||
getAssignmentAction(Entity), CCK); | getAssignmentAction(Entity), CCK); | ||||
if (CurInitExprRes.isInvalid()) | if (CurInitExprRes.isInvalid()) | ||||
return ExprError(); | return ExprError(); | ||||
S.DiscardMisalignedMemberAddress(Step->Type.getTypePtr(), CurInit.get()); | |||||
CurInit = CurInitExprRes; | CurInit = CurInitExprRes; | ||||
if (Step->Kind == SK_ConversionSequenceNoNarrowing && | if (Step->Kind == SK_ConversionSequenceNoNarrowing && | ||||
S.getLangOpts().CPlusPlus && !CurInit.get()->isValueDependent()) | S.getLangOpts().CPlusPlus && !CurInit.get()->isValueDependent()) | ||||
DiagnoseNarrowingInInitList(S, *Step->ICS, SourceType, Entity.getType(), | DiagnoseNarrowingInInitList(S, *Step->ICS, SourceType, Entity.getType(), | ||||
CurInit.get()); | CurInit.get()); | ||||
break; | break; | ||||
} | } | ||||
case SK_ListInitialization: { | case SK_ListInitialization: { | ||||
InitListExpr *InitList = cast<InitListExpr>(CurInit.get()); | InitListExpr *InitList = cast<InitListExpr>(CurInit.get()); | ||||
// If we're not initializing the top-level entity, we need to create an | // If we're not initializing the top-level entity, we need to create an | ||||
// InitializeTemporary entity for our target type. | // InitializeTemporary entity for our target type. | ||||
QualType Ty = Step->Type; | QualType Ty = Step->Type; | ||||
▲ Show 20 Lines • Show All 1,194 Lines • Show Last 20 Lines |