@@ -966,27 +966,11 @@ static bool pathOnlyInitializesGslPointer(IndirectLocalPath &Path) {
966
966
return false ;
967
967
}
968
968
969
- static void checkExprLifetimeImpl (
970
- Sema &SemaRef,
971
- llvm::PointerUnion<const InitializedEntity *, const AssignedEntity *>
972
- CEntity,
973
- Expr *Init) {
974
- LifetimeKind LK = LK_FullExpression;
975
-
976
- const AssignedEntity *AEntity = nullptr ;
977
- // Local variables for initialized entity.
978
- const InitializedEntity *InitEntity = nullptr ;
979
- const InitializedEntity *ExtendingEntity = nullptr ;
980
- if (CEntity.is <const InitializedEntity *>()) {
981
- InitEntity = CEntity.get <const InitializedEntity *>();
982
- auto LTResult = getEntityLifetime (InitEntity);
983
- LK = LTResult.getInt ();
984
- ExtendingEntity = LTResult.getPointer ();
985
- } else {
986
- AEntity = CEntity.get <const AssignedEntity *>();
987
- if (AEntity->LHS ->getType ()->isPointerType ()) // builtin pointer type
988
- LK = LK_Extended;
989
- }
969
+ static void checkExprLifetimeImpl (Sema &SemaRef,
970
+ const InitializedEntity *InitEntity,
971
+ const InitializedEntity *ExtendingEntity,
972
+ LifetimeKind LK,
973
+ const AssignedEntity *AEntity, Expr *Init) {
990
974
// If this entity doesn't have an interesting lifetime, don't bother looking
991
975
// for temporaries within its initializer.
992
976
if (LK == LK_FullExpression)
@@ -1292,12 +1276,18 @@ static void checkExprLifetimeImpl(
1292
1276
1293
1277
void checkExprLifetime (Sema &SemaRef, const InitializedEntity &Entity,
1294
1278
Expr *Init) {
1295
- checkExprLifetimeImpl (SemaRef, &Entity, Init);
1279
+ auto LTResult = getEntityLifetime (&Entity);
1280
+ LifetimeKind LK = LTResult.getInt ();
1281
+ const InitializedEntity *ExtendingEntity = LTResult.getPointer ();
1282
+ checkExprLifetimeImpl (SemaRef, &Entity, ExtendingEntity, LK, nullptr , Init);
1296
1283
}
1297
1284
1298
1285
void checkExprLifetime (Sema &SemaRef, const AssignedEntity &Entity,
1299
1286
Expr *Init) {
1300
- checkExprLifetimeImpl (SemaRef, &Entity, Init);
1287
+ LifetimeKind LK = LK_FullExpression;
1288
+ if (Entity.LHS ->getType ()->isPointerType ()) // builtin pointer type
1289
+ LK = LK_Extended;
1290
+ checkExprLifetimeImpl (SemaRef, nullptr , nullptr , LK, &Entity, Init);
1301
1291
}
1302
1292
1303
1293
} // namespace clang::sema
0 commit comments