[clang] d806d11 - Interp.h - AddSubMulHelper - avoid APSInt::toString std::string wrapper. NFCI

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 9 03:09:55 PDT 2021


Author: Simon Pilgrim
Date: 2021-06-09T11:09:31+01:00
New Revision: d806d11b14e1db7d5c5986d563e74ca972f0e5e6

URL: https://github.com/llvm/llvm-project/commit/d806d11b14e1db7d5c5986d563e74ca972f0e5e6
DIFF: https://github.com/llvm/llvm-project/commit/d806d11b14e1db7d5c5986d563e74ca972f0e5e6.diff

LOG: Interp.h - AddSubMulHelper - avoid APSInt::toString std::string wrapper. NFCI

Pulled out of D103888 - use the underlying SmallString version directly

Added: 
    

Modified: 
    clang/lib/AST/Interp/Interp.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index a63c5a871ba33..e2f7bf0dc26a4 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -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;


        


More information about the cfe-commits mailing list