This is an archive of the discontinued LLVM Phabricator instance.

[nfc] [lldb] Prevent needless copies of DataExtractor
ClosedPublic

Authored by jankratochvil on Aug 4 2021, 10:51 AM.

Details

Summary

This patch was created accidentally but I find it useful when I already wrote it.
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).
OK to check it in?

Diff Detail

Event Timeline

jankratochvil created this revision.Aug 4 2021, 10:51 AM
jankratochvil requested review of this revision.Aug 4 2021, 10:51 AM
clayborg accepted this revision.Aug 4 2021, 11:02 AM
This revision is now accepted and ready to land.Aug 4 2021, 11:02 AM
This revision was landed with ongoing or failed builds.Aug 4 2021, 11:36 AM
This revision was automatically updated to reflect the committed changes.