@@ -379,15 +379,14 @@ bool AddSubMulHelper(InterpState &S, CodePtr OpPC, unsigned Bits, const T &LHS,
379
379
APSInt Value = OpAP<APSInt>()(LHS.toAPSInt (Bits), RHS.toAPSInt (Bits));
380
380
381
381
// Report undefined behaviour, stopping if required.
382
- const Expr *E = S.Current ->getExpr (OpPC);
383
- QualType Type = E->getType ();
384
382
if (S.checkingForUndefinedBehavior ()) {
383
+ const Expr *E = S.Current ->getExpr (OpPC);
384
+ QualType Type = E->getType ();
385
385
SmallString<32 > Trunc;
386
386
Value.trunc (Result.bitWidth ())
387
387
.toString (Trunc, 10 , Result.isSigned (), /* formatAsCLiteral=*/ false ,
388
388
/* UpperCase=*/ true , /* InsertSeparators=*/ true );
389
- auto Loc = E->getExprLoc ();
390
- S.report (Loc, diag::warn_integer_constant_overflow)
389
+ S.report (E->getExprLoc (), diag::warn_integer_constant_overflow)
391
390
<< Trunc << Type << E->getSourceRange ();
392
391
}
393
392
@@ -737,16 +736,14 @@ bool Neg(InterpState &S, CodePtr OpPC) {
737
736
S.Stk .push <T>(Result);
738
737
739
738
APSInt NegatedValue = -Value.toAPSInt (Value.bitWidth () + 1 );
740
- const Expr *E = S.Current ->getExpr (OpPC);
741
- QualType Type = E->getType ();
742
-
743
739
if (S.checkingForUndefinedBehavior ()) {
740
+ const Expr *E = S.Current ->getExpr (OpPC);
741
+ QualType Type = E->getType ();
744
742
SmallString<32 > Trunc;
745
743
NegatedValue.trunc (Result.bitWidth ())
746
744
.toString (Trunc, 10 , Result.isSigned (), /* formatAsCLiteral=*/ false ,
747
745
/* UpperCase=*/ true , /* InsertSeparators=*/ true );
748
- auto Loc = E->getExprLoc ();
749
- S.report (Loc, diag::warn_integer_constant_overflow)
746
+ S.report (E->getExprLoc (), diag::warn_integer_constant_overflow)
750
747
<< Trunc << Type << E->getSourceRange ();
751
748
return true ;
752
749
}
@@ -800,15 +797,14 @@ bool IncDecHelper(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
800
797
APResult = --Value.toAPSInt (Bits);
801
798
802
799
// Report undefined behaviour, stopping if required.
803
- const Expr *E = S.Current ->getExpr (OpPC);
804
- QualType Type = E->getType ();
805
800
if (S.checkingForUndefinedBehavior ()) {
801
+ const Expr *E = S.Current ->getExpr (OpPC);
802
+ QualType Type = E->getType ();
806
803
SmallString<32 > Trunc;
807
804
APResult.trunc (Result.bitWidth ())
808
805
.toString (Trunc, 10 , Result.isSigned (), /* formatAsCLiteral=*/ false ,
809
806
/* UpperCase=*/ true , /* InsertSeparators=*/ true );
810
- auto Loc = E->getExprLoc ();
811
- S.report (Loc, diag::warn_integer_constant_overflow)
807
+ S.report (E->getExprLoc (), diag::warn_integer_constant_overflow)
812
808
<< Trunc << Type << E->getSourceRange ();
813
809
return true ;
814
810
}
0 commit comments