[llvm] 7c009d2 - [PDB] Remove truncate* (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 5 23:33:57 PDT 2022
Author: Kazu Hirata
Date: 2022-06-05T23:33:51-07:00
New Revision: 7c009d2c312adb209e12f64accc8728bb6e34f67
URL: https://github.com/llvm/llvm-project/commit/7c009d2c312adb209e12f64accc8728bb6e34f67
DIFF: https://github.com/llvm/llvm-project/commit/7c009d2c312adb209e12f64accc8728bb6e34f67.diff
LOG: [PDB] Remove truncate* (NFC)
- truncateQuotedNameFront: The last use was removed on Jul 10, 2017 in
commit a9d944fd6fd19ac377b5ebea9272676642b7ceaa.
- truncateQuotedNameBack: The last use was removed on Mar 26, 2018 in
commit 7b84b678a993c8a8236868f65d1d4c2b3e29fb3d.
- truncateStringMiddle: The last use was removed on Mar 26, 2018 in
commit 7b84b678a993c8a8236868f65d1d4c2b3e29fb3d.
- truncateStringBack: The last use is in truncateQuotedNameBack being
removed above.
- truncateStringFront: The last use is in truncateQuotedNameFront
being removed above.
Added:
Modified:
llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h
llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h b/llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h
index ed86537e6b93c..ed745eaf97274 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h
@@ -22,14 +22,6 @@
namespace llvm {
namespace pdb {
-std::string truncateStringBack(StringRef S, uint32_t MaxLen);
-std::string truncateStringMiddle(StringRef S, uint32_t MaxLen);
-std::string truncateStringFront(StringRef S, uint32_t MaxLen);
-std::string truncateQuotedNameFront(StringRef Label, StringRef Name,
- uint32_t MaxLen);
-std::string truncateQuotedNameBack(StringRef Label, StringRef Name,
- uint32_t MaxLen);
-
#define PUSH_MASKED_FLAG(Enum, Mask, TheOpt, Value, Text) \
if (Enum::TheOpt == (Value & Mask)) \
Opts.push_back(Text);
diff --git a/llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp b/llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp
index 53de70b6f7aba..a167d45982a90 100644
--- a/llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp
@@ -19,58 +19,6 @@ using namespace llvm;
using namespace llvm::codeview;
using namespace llvm::pdb;
-std::string llvm::pdb::truncateStringBack(StringRef S, uint32_t MaxLen) {
- if (MaxLen == 0 || S.size() <= MaxLen || S.size() <= 3)
- return std::string(S);
-
- assert(MaxLen >= 3);
- uint32_t FinalLen = std::min<size_t>(S.size(), MaxLen - 3);
- S = S.take_front(FinalLen);
- return std::string(S) + std::string("...");
-}
-
-std::string llvm::pdb::truncateStringMiddle(StringRef S, uint32_t MaxLen) {
- if (MaxLen == 0 || S.size() <= MaxLen || S.size() <= 3)
- return std::string(S);
-
- assert(MaxLen >= 3);
- uint32_t FinalLen = std::min<size_t>(S.size(), MaxLen - 3);
- StringRef Front = S.take_front(FinalLen / 2);
- StringRef Back = S.take_back(Front.size());
- return std::string(Front) + std::string("...") + std::string(Back);
-}
-
-std::string llvm::pdb::truncateStringFront(StringRef S, uint32_t MaxLen) {
- if (MaxLen == 0 || S.size() <= MaxLen || S.size() <= 3)
- return std::string(S);
-
- assert(MaxLen >= 3);
- S = S.take_back(MaxLen - 3);
- return std::string("...") + std::string(S);
-}
-
-std::string llvm::pdb::truncateQuotedNameFront(StringRef Label, StringRef Name,
- uint32_t MaxLen) {
- uint32_t RequiredExtraChars = Label.size() + 1 + 2;
- if (MaxLen == 0 || RequiredExtraChars + Name.size() <= MaxLen)
- return formatv("{0} \"{1}\"", Label, Name).str();
-
- assert(MaxLen >= RequiredExtraChars);
- std::string TN = truncateStringFront(Name, MaxLen - RequiredExtraChars);
- return formatv("{0} \"{1}\"", Label, TN).str();
-}
-
-std::string llvm::pdb::truncateQuotedNameBack(StringRef Label, StringRef Name,
- uint32_t MaxLen) {
- uint32_t RequiredExtraChars = Label.size() + 1 + 2;
- if (MaxLen == 0 || RequiredExtraChars + Name.size() <= MaxLen)
- return formatv("{0} \"{1}\"", Label, Name).str();
-
- assert(MaxLen >= RequiredExtraChars);
- std::string TN = truncateStringBack(Name, MaxLen - RequiredExtraChars);
- return formatv("{0} \"{1}\"", Label, TN).str();
-}
-
std::string llvm::pdb::typesetItemList(ArrayRef<std::string> Opts,
uint32_t IndentLevel, uint32_t GroupSize,
StringRef Sep) {
More information about the llvm-commits
mailing list