This is an archive of the discontinued LLVM Phabricator instance.

[lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf
ClosedPublic

Authored by bulbazord on Apr 18 2023, 5:01 PM.

Details

Summary

Instead of creating a std::string from the SmallString,
let's just use a std::string from the start. I initially tried to make
SmallString work but getting it right proved complicated because
LogHandler::Emit will take its StringRef parameter and touch the raw
const char * from it directly, which isn't guaranteed to be
null-terminated with a SmallString.

I changed WriteMessage to take a StringRef instead of a
const std::string & for flexibility.

Diff Detail

Event Timeline

bulbazord created this revision.Apr 18 2023, 5:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2023, 5:01 PM
bulbazord requested review of this revision.Apr 18 2023, 5:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2023, 5:01 PM
mib accepted this revision.Apr 18 2023, 5:24 PM

Makes sense. LGTM!

This revision is now accepted and ready to land.Apr 18 2023, 5:24 PM
This revision was landed with ongoing or failed builds.Apr 19 2023, 2:18 PM
This revision was automatically updated to reflect the committed changes.