[all-commits] [llvm/llvm-project] 77e391: [lldb][NFCI] Stop creating additional temporary st...

Alex via All-commits all-commits at lists.llvm.org
Wed Apr 19 14:18:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77e3914be7c99a76a2f728adbb2a169d7cfc5a10
      https://github.com/llvm/llvm-project/commit/77e3914be7c99a76a2f728adbb2a169d7cfc5a10
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-04-19 (Wed, 19 Apr 2023)

  Changed paths:
    M lldb/include/lldb/Utility/Log.h
    M lldb/source/Utility/Log.cpp

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

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.

Differential Revision: https://reviews.llvm.org/D148676




More information about the All-commits mailing list