Interp.h - AddSubMulHelper - avoid APSInt::toString std::string wrapper. NFCI
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 9 Jun 2021 10:06:23 +0000 (11:06 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 9 Jun 2021 10:09:31 +0000 (11:09 +0100)
Pulled out of D103888 - use the underlying SmallString version directly

clang/lib/AST/Interp/Interp.h

index a63c5a8..e2f7bf0 100644 (file)
@@ -118,7 +118,8 @@ bool AddSubMulHelper(InterpState &S, CodePtr OpPC, unsigned Bits, const T &LHS,
   const Expr *E = S.Current->getExpr(OpPC);
   QualType Type = E->getType();
   if (S.checkingForUndefinedBehavior()) {
-    auto Trunc = Value.trunc(Result.bitWidth()).toString(10);
+    SmallString<32> Trunc;
+    Value.trunc(Result.bitWidth()).toString(Trunc, 10);
     auto Loc = E->getExprLoc();
     S.report(Loc, diag::warn_integer_constant_overflow) << Trunc << Type;
     return true;