@@ -1285,7 +1285,13 @@ bool Compiler<Emitter>::VisitArraySubscriptExpr(const ArraySubscriptExpr *E) {
1285
1285
template <class Emitter >
1286
1286
bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1287
1287
const Expr *ArrayFiller, const Expr *E) {
1288
- if (E->getType ()->isVoidType ())
1288
+
1289
+ QualType QT = E->getType ();
1290
+
1291
+ if (const auto *AT = QT->getAs <AtomicType>())
1292
+ QT = AT->getValueType ();
1293
+
1294
+ if (QT->isVoidType ())
1289
1295
return this ->emitInvalid (E);
1290
1296
1291
1297
// Handle discarding first.
@@ -1298,17 +1304,16 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1298
1304
}
1299
1305
1300
1306
// Primitive values.
1301
- if (std::optional<PrimType> T = classify (E-> getType () )) {
1307
+ if (std::optional<PrimType> T = classify (QT )) {
1302
1308
assert (!DiscardResult);
1303
1309
if (Inits.size () == 0 )
1304
- return this ->visitZeroInitializer (*T, E-> getType () , E);
1310
+ return this ->visitZeroInitializer (*T, QT , E);
1305
1311
assert (Inits.size () == 1 );
1306
1312
return this ->delegate (Inits[0 ]);
1307
1313
}
1308
1314
1309
- QualType T = E->getType ();
1310
- if (T->isRecordType ()) {
1311
- const Record *R = getRecord (E->getType ());
1315
+ if (QT->isRecordType ()) {
1316
+ const Record *R = getRecord (QT);
1312
1317
1313
1318
if (Inits.size () == 1 && E->getType () == Inits[0 ]->getType ())
1314
1319
return this ->delegate (Inits[0 ]);
@@ -1405,8 +1410,8 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1405
1410
return this ->emitFinishInit (E);
1406
1411
}
1407
1412
1408
- if (T ->isArrayType ()) {
1409
- if (Inits.size () == 1 && E-> getType () == Inits[0 ]->getType ())
1413
+ if (QT ->isArrayType ()) {
1414
+ if (Inits.size () == 1 && QT == Inits[0 ]->getType ())
1410
1415
return this ->delegate (Inits[0 ]);
1411
1416
1412
1417
unsigned ElementIndex = 0 ;
@@ -1438,7 +1443,7 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1438
1443
// FIXME: This should go away.
1439
1444
if (ArrayFiller) {
1440
1445
const ConstantArrayType *CAT =
1441
- Ctx.getASTContext ().getAsConstantArrayType (E-> getType () );
1446
+ Ctx.getASTContext ().getAsConstantArrayType (QT );
1442
1447
uint64_t NumElems = CAT->getZExtSize ();
1443
1448
1444
1449
for (; ElementIndex != NumElems; ++ElementIndex) {
@@ -1450,7 +1455,7 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1450
1455
return this ->emitFinishInit (E);
1451
1456
}
1452
1457
1453
- if (const auto *ComplexTy = E-> getType () ->getAs <ComplexType>()) {
1458
+ if (const auto *ComplexTy = QT ->getAs <ComplexType>()) {
1454
1459
unsigned NumInits = Inits.size ();
1455
1460
1456
1461
if (NumInits == 1 )
@@ -1480,7 +1485,7 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1480
1485
return true ;
1481
1486
}
1482
1487
1483
- if (const auto *VecT = E-> getType () ->getAs <VectorType>()) {
1488
+ if (const auto *VecT = QT ->getAs <VectorType>()) {
1484
1489
unsigned NumVecElements = VecT->getNumElements ();
1485
1490
assert (NumVecElements >= Inits.size ());
1486
1491
0 commit comments