@@ -379,15 +379,14 @@ bool AddSubMulHelper(InterpState &S, CodePtr OpPC, unsigned Bits, const T &LHS,
379379 APSInt Value = OpAP<APSInt>()(LHS.toAPSInt (Bits), RHS.toAPSInt (Bits));
380380
381381 // Report undefined behaviour, stopping if required.
382- const Expr *E = S.Current ->getExpr (OpPC);
383- QualType Type = E->getType ();
384382 if (S.checkingForUndefinedBehavior ()) {
383+ const Expr *E = S.Current ->getExpr (OpPC);
384+ QualType Type = E->getType ();
385385 SmallString<32 > Trunc;
386386 Value.trunc (Result.bitWidth ())
387387 .toString (Trunc, 10 , Result.isSigned (), /* formatAsCLiteral=*/ false ,
388388 /* 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)
391390 << Trunc << Type << E->getSourceRange ();
392391 }
393392
@@ -737,16 +736,14 @@ bool Neg(InterpState &S, CodePtr OpPC) {
737736 S.Stk .push <T>(Result);
738737
739738 APSInt NegatedValue = -Value.toAPSInt (Value.bitWidth () + 1 );
740- const Expr *E = S.Current ->getExpr (OpPC);
741- QualType Type = E->getType ();
742-
743739 if (S.checkingForUndefinedBehavior ()) {
740+ const Expr *E = S.Current ->getExpr (OpPC);
741+ QualType Type = E->getType ();
744742 SmallString<32 > Trunc;
745743 NegatedValue.trunc (Result.bitWidth ())
746744 .toString (Trunc, 10 , Result.isSigned (), /* formatAsCLiteral=*/ false ,
747745 /* 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)
750747 << Trunc << Type << E->getSourceRange ();
751748 return true ;
752749 }
@@ -800,15 +797,14 @@ bool IncDecHelper(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
800797 APResult = --Value.toAPSInt (Bits);
801798
802799 // Report undefined behaviour, stopping if required.
803- const Expr *E = S.Current ->getExpr (OpPC);
804- QualType Type = E->getType ();
805800 if (S.checkingForUndefinedBehavior ()) {
801+ const Expr *E = S.Current ->getExpr (OpPC);
802+ QualType Type = E->getType ();
806803 SmallString<32 > Trunc;
807804 APResult.trunc (Result.bitWidth ())
808805 .toString (Trunc, 10 , Result.isSigned (), /* formatAsCLiteral=*/ false ,
809806 /* 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)
812808 << Trunc << Type << E->getSourceRange ();
813809 return true ;
814810 }
0 commit comments