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

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