[all-commits] [llvm/llvm-project] 14f443: [nfc] [lldb] Prevent needless copies of DataExtractor

Jan Kratochvil via All-commits all-commits at lists.llvm.org
Wed Aug 4 11:36:06 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 14f443030c1acc4346589aee3c1c532dc00eae3a
      https://github.com/llvm/llvm-project/commit/14f443030c1acc4346589aee3c1c532dc00eae3a
  Author: Jan Kratochvil <jan.kratochvil at redhat.com>
  Date:   2021-08-04 (Wed, 04 Aug 2021)

  Changed paths:
    M lldb/include/lldb/DataFormatters/StringPrinter.h
    M lldb/include/lldb/Utility/DataExtractor.h
    M lldb/source/DataFormatters/StringPrinter.cpp
    M lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
    M lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
    M lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
    M lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
    M lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
    M lldb/unittests/DataFormatter/StringPrinterTests.cpp

  Log Message:
  -----------
  [nfc] [lldb] Prevent needless copies of DataExtractor

lldb_private::DataExtractor contains DataBufferSP m_data_sp which is
relatively expensive to copy (due to multi-threading locking).

llvm::DataExtractor does not have this problem as it uses StringRef
instead.

The copy constructor is explicit as otherwise it is easy to make
unintended modification of a local copy instead of a caller's instance
(D107470 but that is llvm::DataExtractor).

Reviewed By: clayborg

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




More information about the All-commits mailing list