[clang] f3fd36e - JSONNodeDumper.cpp - VisitIntegerLiteral - avoid APSInt::toString std::string wrapper. NFCI

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


Author: Simon Pilgrim
Date: 2021-06-09T11:09:32+01:00
New Revision: f3fd36e590f4ca36e466801bee40497714df895c

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

LOG: JSONNodeDumper.cpp - VisitIntegerLiteral - avoid APSInt::toString std::string wrapper. NFCI

Pulled out of D103888 - use the underlying SmallString version directly

Added: 
    

Modified: 
    clang/lib/AST/JSONNodeDumper.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/JSONNodeDumper.cpp b/clang/lib/AST/JSONNodeDumper.cpp
index d2835583a0f2..038aceea54ff 100644
--- a/clang/lib/AST/JSONNodeDumper.cpp
+++ b/clang/lib/AST/JSONNodeDumper.cpp
@@ -1414,9 +1414,10 @@ void JSONNodeDumper::VisitCXXDependentScopeMemberExpr(
 }
 
 void JSONNodeDumper::VisitIntegerLiteral(const IntegerLiteral *IL) {
-  JOS.attribute("value",
-                IL->getValue().toString(
-                    /*Radix=*/10, IL->getType()->isSignedIntegerType()));
+  llvm::SmallString<16> Buffer;
+  IL->getValue().toString(Buffer,
+                          /*Radix=*/10, IL->getType()->isSignedIntegerType());
+  JOS.attribute("value", Buffer);
 }
 void JSONNodeDumper::VisitCharacterLiteral(const CharacterLiteral *CL) {
   // FIXME: This should probably print the character literal as a string,


        


More information about the cfe-commits mailing list