This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Remove __FUNCTION__ from log messages in lldbHost (NFC)
ClosedPublic

Authored by JDevlieghere on May 30 2023, 4:04 PM.

Details

Summary

LLDB's logging infrastructure supports prepending log messages with the name of the file and function that generates the log (see help log enable). Therefore it's unnecessary to include the current __FUNCTION__ in the log message itself. This patch removes __FUNCTION__ from log messages in the Host library.

Diff Detail

Event Timeline

JDevlieghere created this revision.May 30 2023, 4:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2023, 4:04 PM
JDevlieghere requested review of this revision.May 30 2023, 4:04 PM
bulbazord accepted this revision.May 30 2023, 4:09 PM
bulbazord added a subscriber: bulbazord.

The change itself looks fine and is fairly mechanical. Easy to verify.

One thing that I see here is we're treating the result of llvm::StringRef::data() as a c-string which isn't guaranteed to be true. That makes me a little nervous. As frustrating as temporary allocations are, the right thing to do would be something like foo.str().c_str() where foo is a StringRef. If you think it's appropriate, can you change those instances in this patch? If not we can do it in a follow-up.

This revision is now accepted and ready to land.May 30 2023, 4:09 PM
mib accepted this revision as: mib.May 30 2023, 4:36 PM
mib added a subscriber: mib.

LGTM! Are you considering doing it for the rest of the codebase as well ? That would be very nice :)

LGTM! Are you considering doing it for the rest of the codebase as well ? That would be very nice :)

Yup, that's the goal. I wanted to gather some initial feedback before I go through the other libs.

Use LLDB_LOG when StringRefs are involved.

Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 1:03 PM