From 61cdaf66fe22be2b5942ddee4f46a998b4f3ee29 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 11 Jun 2021 13:19:00 +0100 Subject: [ADT] Remove APInt/APSInt toString() std::string variants is currently the highest impact header in a clang+llvm build: https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html One of the most common places this is being included is the APInt.h header, which needs it for an old toString() implementation that returns std::string - an inefficient method compared to the SmallString versions that it actually wraps. This patch replaces these APInt/APSInt methods with a pair of llvm::toString() helpers inside StringExtras.h, adjusts users accordingly and removes the from APInt.h - I was hoping that more of these users could be converted to use the SmallString methods, but it appears that most end up creating a std::string anyhow. I avoided trying to use the raw_ostream << operators as well as I didn't want to lose having the integer radix explicit in the code. Differential Revision: https://reviews.llvm.org/D103888 --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c3a4b1ba6b3d..369c4b6ccef9 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -206,7 +206,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO, // created with -funique-internal-linakge-symbols and the tools can strip or // keep the prefix as needed. ModuleNameHash = (Twine(".__uniq.") + - Twine(IntHash.toString(/* Radix = */ 10, /* Signed = */false))).str(); + Twine(toString(IntHash, /* Radix = */ 10, /* Signed = */false))).str(); } } -- cgit v1.2.3