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

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