@@ -493,8 +493,8 @@ template <class Emitter>
493
493
bool ByteCodeExprGen<Emitter>::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *E) {
494
494
QualType QT = E->getType ();
495
495
496
- if (classify (QT))
497
- return this ->visitZeroInitializer (QT, E);
496
+ if (std::optional<PrimType> T = classify (QT))
497
+ return this ->visitZeroInitializer (*T, QT, E);
498
498
499
499
if (QT->isRecordType ())
500
500
return false ;
@@ -510,7 +510,7 @@ bool ByteCodeExprGen<Emitter>::VisitImplicitValueInitExpr(const ImplicitValueIni
510
510
// since we memset our Block*s to 0 and so we have the desired value
511
511
// without this.
512
512
for (size_t I = 0 ; I != NumElems; ++I) {
513
- if (!this ->visitZeroInitializer (CAT->getElementType (), E))
513
+ if (!this ->visitZeroInitializer (*ElemT, CAT->getElementType (), E))
514
514
return false ;
515
515
if (!this ->emitInitElem (*ElemT, I, E))
516
516
return false ;
@@ -620,7 +620,7 @@ bool ByteCodeExprGen<Emitter>::VisitInitListExpr(const InitListExpr *E) {
620
620
if (std::optional<PrimType> T = classify (E->getType ())) {
621
621
assert (!DiscardResult);
622
622
if (E->getNumInits () == 0 )
623
- return this ->visitZeroInitializer (E->getType (), E);
623
+ return this ->visitZeroInitializer (*T, E->getType (), E);
624
624
assert (E->getNumInits () == 1 );
625
625
return this ->delegate (E->inits ()[0 ]);
626
626
}
@@ -1560,7 +1560,8 @@ bool ByteCodeExprGen<Emitter>::VisitOffsetOfExpr(const OffsetOfExpr *E) {
1560
1560
template <class Emitter >
1561
1561
bool ByteCodeExprGen<Emitter>::VisitCXXScalarValueInitExpr(
1562
1562
const CXXScalarValueInitExpr *E) {
1563
- return this ->visitZeroInitializer (E->getType (), E);
1563
+ return this ->visitZeroInitializer (classifyPrim (E->getType ()), E->getType (),
1564
+ E);
1564
1565
}
1565
1566
1566
1567
template <class Emitter > bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
@@ -1648,12 +1649,8 @@ bool ByteCodeExprGen<Emitter>::visitBool(const Expr *E) {
1648
1649
}
1649
1650
1650
1651
template <class Emitter >
1651
- bool ByteCodeExprGen<Emitter>::visitZeroInitializer(QualType QT,
1652
+ bool ByteCodeExprGen<Emitter>::visitZeroInitializer(PrimType T, QualType QT,
1652
1653
const Expr *E) {
1653
- // FIXME: We need the QualType to get the float semantics, but that means we
1654
- // classify it over and over again in array situations.
1655
- PrimType T = classifyPrim (QT);
1656
-
1657
1654
switch (T) {
1658
1655
case PT_Bool:
1659
1656
return this ->emitZeroBool (E);
@@ -1699,7 +1696,7 @@ bool ByteCodeExprGen<Emitter>::visitZeroRecordInitializer(const Record *R,
1699
1696
if (D->isPrimitive ()) {
1700
1697
QualType QT = D->getType ();
1701
1698
PrimType T = classifyPrim (D->getType ());
1702
- if (!this ->visitZeroInitializer (QT, E))
1699
+ if (!this ->visitZeroInitializer (T, QT, E))
1703
1700
return false ;
1704
1701
if (!this ->emitInitField (T, Field.Offset , E))
1705
1702
return false ;
@@ -1716,7 +1713,7 @@ bool ByteCodeExprGen<Emitter>::visitZeroRecordInitializer(const Record *R,
1716
1713
QualType ET = D->getElemQualType ();
1717
1714
PrimType T = classifyPrim (ET);
1718
1715
for (uint32_t I = 0 , N = D->getNumElems (); I != N; ++I) {
1719
- if (!this ->visitZeroInitializer (ET, E))
1716
+ if (!this ->visitZeroInitializer (T, ET, E))
1720
1717
return false ;
1721
1718
if (!this ->emitInitElem (T, I, E))
1722
1719
return false ;
0 commit comments