Blame SOURCES/bcc-0.20.0-Remove-APInt-APSInt-toString-std-string-variants.patch

605647
From fd0585d5d8a1a47912ae7a70721d3cab0c7d06f8 Mon Sep 17 00:00:00 2001
605647
From: Khem Raj <raj.khem@gmail.com>
605647
Date: Mon, 14 Jun 2021 12:49:43 -0700
605647
Subject: [PATCH] Remove APInt/APSInt toString() std::string variants
605647
605647
clang 13+ has removed this in favour of a pair of llvm::toString
605647
() helpers inside StringExtras.h to improve compile speed by avoiding
605647
hits on <string> header
605647
605647
Signed-off-by: Khem Raj <raj.khem@gmail.com>
605647
---
605647
 src/cc/json_map_decl_visitor.cc | 5 +++++
605647
 1 file changed, 5 insertions(+)
605647
605647
diff --git a/src/cc/json_map_decl_visitor.cc b/src/cc/json_map_decl_visitor.cc
605647
index eff4d067..53896199 100644
605647
--- a/src/cc/json_map_decl_visitor.cc
605647
+++ b/src/cc/json_map_decl_visitor.cc
605647
@@ -20,6 +20,7 @@
605647
 #include <clang/AST/ASTContext.h>
605647
 #include <clang/AST/RecordLayout.h>
605647
 #include <clang/AST/RecursiveASTVisitor.h>
605647
+#include <llvm/ADT/StringExtras.h>
605647
 #include "common.h"
605647
 #include "table_desc.h"
605647
 
605647
@@ -79,7 +80,11 @@ void BMapDeclVisitor::genJSONForField(FieldDecl *F) {
605647
   result_ += "[";
605647
   TraverseDecl(F);
605647
   if (const ConstantArrayType *T = dyn_cast<ConstantArrayType>(F->getType()))
605647
+#if LLVM_MAJOR_VERSION >= 13
605647
+    result_ += ", [" + toString(T->getSize(), 10, false) + "]";
605647
+#else
605647
     result_ += ", [" + T->getSize().toString(10, false) + "]";
605647
+#endif
605647
   if (F->isBitField())
605647
     result_ += ", " + to_string(F->getBitWidthValue(C));
605647
   result_ += "], ";
605647
-- 
605647
2.31.1
605647