@@ -1252,9 +1252,8 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
1252
1252
return;
1253
1253
}
1254
1254
#endif
1255
-
1256
- AggValueSlot Dest = EnsureSlot (CGF.getLoc (ExprToVisit->getSourceRange ()),
1257
- ExprToVisit->getType ());
1255
+ const mlir::Location loc = CGF.getLoc (ExprToVisit->getSourceRange ());
1256
+ AggValueSlot Dest = EnsureSlot (loc, ExprToVisit->getType ());
1258
1257
1259
1258
LValue DestLV = CGF.makeAddrLValue (Dest.getAddress (), ExprToVisit->getType ());
1260
1259
@@ -1294,8 +1293,20 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
1294
1293
if (auto *CXXRD = dyn_cast<CXXRecordDecl>(record)) {
1295
1294
assert (NumInitElements >= CXXRD->getNumBases () &&
1296
1295
" missing initializer for base class" );
1297
- for ([[maybe_unused]] auto &Base : CXXRD->bases ()) {
1298
- llvm_unreachable (" NYI" );
1296
+ for (auto &Base : CXXRD->bases ()) {
1297
+ assert (!Base.isVirtual () && " should not see vbases here" );
1298
+ auto *BaseRD = Base.getType ()->getAsCXXRecordDecl ();
1299
+ Address address = CGF.getAddressOfDirectBaseInCompleteClass (
1300
+ loc, Dest.getAddress (), CXXRD, BaseRD,
1301
+ /* isBaseVirtual*/ false );
1302
+ AggValueSlot aggSlot = AggValueSlot::forAddr (
1303
+ address, Qualifiers (), AggValueSlot::IsDestructed,
1304
+ AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsNotAliased,
1305
+ CGF.getOverlapForBaseInit (CXXRD, BaseRD, false ));
1306
+ CGF.emitAggExpr (InitExprs[curInitIndex++], aggSlot);
1307
+ if (QualType::DestructionKind dtorKind =
1308
+ Base.getType ().isDestructedType ())
1309
+ CGF.pushDestroyAndDeferDeactivation (dtorKind, address, Base.getType ());
1299
1310
}
1300
1311
}
1301
1312
@@ -1329,8 +1340,7 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
1329
1340
emitInitializationToLValue (InitExprs[0 ], FieldLoc);
1330
1341
} else {
1331
1342
// Default-initialize to null.
1332
- emitNullInitializationToLValue (CGF.getLoc (ExprToVisit->getSourceRange ()),
1333
- FieldLoc);
1343
+ emitNullInitializationToLValue (loc, FieldLoc);
1334
1344
}
1335
1345
1336
1346
return ;
0 commit comments