Remove APInt/APSInt toString() std::string variants
authorKhem Raj <raj.khem@gmail.com>
Mon, 14 Jun 2021 19:49:43 +0000 (12:49 -0700)
committeryonghong-song <ys114321@gmail.com>
Tue, 15 Jun 2021 04:26:13 +0000 (21:26 -0700)
clang 13+ has removed this in favour of a pair of llvm::toString
() helpers inside StringExtras.h to improve compile speed by avoiding
hits on <string> header

Signed-off-by: Khem Raj <raj.khem@gmail.com>
src/cc/json_map_decl_visitor.cc

index eff4d067fa526bd0d3352d15b3215b58098e696f..53896199965e49914d776c6fd937e340354bbe26 100644 (file)
@@ -20,6 +20,7 @@
 #include <clang/AST/ASTContext.h>
 #include <clang/AST/RecordLayout.h>
 #include <clang/AST/RecursiveASTVisitor.h>
+#include <llvm/ADT/StringExtras.h>
 #include "common.h"
 #include "table_desc.h"
 
@@ -79,7 +80,11 @@ void BMapDeclVisitor::genJSONForField(FieldDecl *F) {
   result_ += "[";
   TraverseDecl(F);
   if (const ConstantArrayType *T = dyn_cast<ConstantArrayType>(F->getType()))
+#if LLVM_MAJOR_VERSION >= 13
+    result_ += ", [" + toString(T->getSize(), 10, false) + "]";
+#else
     result_ += ", [" + T->getSize().toString(10, false) + "]";
+#endif
   if (F->isBitField())
     result_ += ", " + to_string(F->getBitWidthValue(C));
   result_ += "], ";