Skip to content

Commit 49e8c86

Browse files
[memprof] Use ListSeparator (NFC)
ListSeparator from StringExtras.h is essentially the same as FieldSeparator being removed in this patch. ListSeparator returns the empty string on the first use via "operator StringRef()". It returns ", " on subsequent uses.
1 parent f65a21a commit 49e8c86

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -896,21 +896,6 @@ struct DenseMapInfo<IndexCall>
896896

897897
namespace {
898898

899-
struct FieldSeparator {
900-
bool Skip = true;
901-
const char *Sep;
902-
903-
FieldSeparator(const char *Sep = ", ") : Sep(Sep) {}
904-
};
905-
906-
raw_ostream &operator<<(raw_ostream &OS, FieldSeparator &FS) {
907-
if (FS.Skip) {
908-
FS.Skip = false;
909-
return OS;
910-
}
911-
return OS << FS.Sep;
912-
}
913-
914899
// Map the uint8_t alloc types (which may contain NotCold|Cold) to the alloc
915900
// type we should actually use on the corresponding allocation.
916901
// If we can't clone a node that has NotCold+Cold alloc type, we will fall
@@ -2784,9 +2769,9 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::ContextNode::print(
27842769
OS << "\t\t" << *Edge << "\n";
27852770
if (!Clones.empty()) {
27862771
OS << "\tClones: ";
2787-
FieldSeparator FS;
2772+
ListSeparator LS;
27882773
for (auto *Clone : Clones)
2789-
OS << FS << Clone;
2774+
OS << LS << Clone;
27902775
OS << "\n";
27912776
} else if (CloneOf) {
27922777
OS << "\tClone of " << CloneOf << "\n";

0 commit comments

Comments
 (0)