This is an archive of the discontinued LLVM Phabricator instance.

[lldb][NFCI] Change type of Broadcaster's name
ClosedPublic

Authored by bulbazord on Jun 5 2023, 6:06 PM.

Details

Summary

Broadcasters don't need their names in the StringPool. It doesn't
benefit from fast comparisons and doesn't benefit from uniqueness.

Diff Detail

Event Timeline

bulbazord created this revision.Jun 5 2023, 6:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2023, 6:06 PM
bulbazord requested review of this revision.Jun 5 2023, 6:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2023, 6:06 PM
JDevlieghere requested changes to this revision.Jun 6 2023, 10:27 AM
JDevlieghere added inline comments.
lldb/include/lldb/Utility/Broadcaster.h
157

If we're going to store this as a std::string you should take it it by value and move it into the member.

lldb/source/Utility/Broadcaster.cpp
26–28
This revision now requires changes to proceed.Jun 6 2023, 10:27 AM
bulbazord updated this revision to Diff 529029.Jun 6 2023, 1:42 PM

Address @JDevlieghere's comments

bulbazord updated this revision to Diff 529031.Jun 6 2023, 1:43 PM

LLDB_LOGF -> LLDB_LOG where needed

bulbazord marked 2 inline comments as done.Jun 6 2023, 2:28 PM
JDevlieghere accepted this revision.Jun 6 2023, 3:26 PM

LGTM modulo inline question.

lldb/include/lldb/Utility/Broadcaster.h
358–360

Why not return a const std::string & here or, alternatively, why not return a StringRef above?

This revision is now accepted and ready to land.Jun 6 2023, 3:26 PM
bulbazord added inline comments.Jun 6 2023, 3:36 PM
lldb/include/lldb/Utility/Broadcaster.h
358–360

Good question. IMO it'd be nice to return a StringRef here but it's probably more practical to return a const std::string & here since we often pass it to printf-style formatters for logging (which, for StringRef, you'd need to do ref.str().c_str() to do it safely).

bulbazord updated this revision to Diff 529069.Jun 6 2023, 3:47 PM

llvm::StringRef -> const std::string &

bulbazord marked an inline comment as done.Jun 6 2023, 3:49 PM
This revision was automatically updated to reflect the committed changes.