[all-commits] [llvm/llvm-project] e7c48f: [lldb][NFCI] Avoid construction of temporary std::...

Alex via All-commits all-commits at lists.llvm.org
Tue Jul 11 10:23:12 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e7c48ffde1c8137822a1b0a1ba6c4be5b4624aa6
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M lldb/source/Symbol/Variable.cpp

  Log Message:
  [lldb][NFCI] Avoid construction of temporary std::strings in Variable

A common thing to do is to call `str().c_str()` to get a null-terminated
string out of an existing StringRef. Most of the time this is to be able
to use a printf-style format string. However, llvm::formatv can handle
StringRefs without the need for the additional allocation. Using that
makes more sense.

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

More information about the All-commits mailing list