@@ -145,10 +145,8 @@ bool ByteCodeExprGen<Emitter>::VisitIntegerLiteral(const IntegerLiteral *LE) {
145
145
if (DiscardResult)
146
146
return true ;
147
147
148
- auto Val = LE->getValue ();
149
- QualType LitTy = LE->getType ();
150
- if (Optional<PrimType> T = classify (LitTy))
151
- return emitConst (*T, getIntWidth (LitTy), LE->getValue (), LE);
148
+ if (Optional<PrimType> T = classify (LE->getType ()))
149
+ return emitConst (*T, LE->getValue (), LE);
152
150
return this ->bail (LE);
153
151
}
154
152
@@ -345,7 +343,7 @@ bool ByteCodeExprGen<Emitter>::VisitArrayInitIndexExpr(
345
343
return false ;
346
344
QualType IndexType = E->getType ();
347
345
APInt Value (getIntWidth (IndexType), *ArrayIndex);
348
- return this ->emitConst (classifyPrim (IndexType), 0 , Value, E);
346
+ return this ->emitConst (classifyPrim (IndexType), Value, E);
349
347
}
350
348
351
349
template <class Emitter >
@@ -569,8 +567,8 @@ bool ByteCodeExprGen<Emitter>::dereferenceVar(
569
567
}
570
568
571
569
template <class Emitter >
572
- bool ByteCodeExprGen<Emitter>::emitConst(PrimType T, unsigned NumBits ,
573
- const APInt &Value, const Expr *E) {
570
+ bool ByteCodeExprGen<Emitter>::emitConst(PrimType T, const APInt &Value ,
571
+ const Expr *E) {
574
572
switch (T) {
575
573
case PT_Sint8:
576
574
return this ->emitConstSint8 (Value.getSExtValue (), E);
@@ -1092,8 +1090,7 @@ bool ByteCodeExprGen<Emitter>::VisitDeclRefExpr(const DeclRefExpr *E) {
1092
1090
} else if (const auto *ECD = dyn_cast<EnumConstantDecl>(Decl)) {
1093
1091
PrimType T = *classify (ECD->getType ());
1094
1092
1095
- return this ->emitConst (T, getIntWidth (ECD->getType ()), ECD->getInitVal (),
1096
- E);
1093
+ return this ->emitConst (T, ECD->getInitVal (), E);
1097
1094
}
1098
1095
1099
1096
// References are implemented using pointers, so when we get here,
0 commit comments