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