[objdump] Use ListSeparator (NFC)

This commit is contained in:
Kazu Hirata 2021-03-06 15:52:54 -08:00
parent 31443f8e86
commit 3e8be5ab87
1 changed files with 11 additions and 27 deletions

View File

@ -7160,17 +7160,15 @@ static void emitComments(raw_svector_ostream &CommentStream,
// Get the default information for printing a comment.
StringRef CommentBegin = MAI.getCommentString();
unsigned CommentColumn = MAI.getCommentColumn();
bool IsFirst = true;
ListSeparator LS("\n");
while (!Comments.empty()) {
if (!IsFirst)
FormattedOS << '\n';
FormattedOS << LS;
// Emit a line of comments.
FormattedOS.PadToColumn(CommentColumn);
size_t Position = Comments.find('\n');
FormattedOS << CommentBegin << ' ' << Comments.substr(0, Position);
// Move after the newline character.
Comments = Comments.substr(Position + 1);
IsFirst = false;
}
FormattedOS.flush();
@ -10296,30 +10294,16 @@ static void printMachOExportsTrie(const object::MachOObjectFile *Obj) {
Entry.address() + BaseSegmentAddress);
outs() << Entry.name();
if (WeakDef || ThreadLocal || Resolver || Abs) {
bool NeedsComma = false;
ListSeparator LS;
outs() << " [";
if (WeakDef) {
outs() << "weak_def";
NeedsComma = true;
}
if (ThreadLocal) {
if (NeedsComma)
outs() << ", ";
outs() << "per-thread";
NeedsComma = true;
}
if (Abs) {
if (NeedsComma)
outs() << ", ";
outs() << "absolute";
NeedsComma = true;
}
if (Resolver) {
if (NeedsComma)
outs() << ", ";
outs() << format("resolver=0x%08llX", Entry.other());
NeedsComma = true;
}
if (WeakDef)
outs() << LS << "weak_def";
if (ThreadLocal)
outs() << LS << "per-thread";
if (Abs)
outs() << LS << "absolute";
if (Resolver)
outs() << LS << format("resolver=0x%08llX", Entry.other());
outs() << "]";
}
if (ReExport) {