[all-commits] [llvm/llvm-project] 3bec33: [trace] Replace TraceCursorUP with TraceCursorSP

Jakob Johnson via All-commits all-commits at lists.llvm.org
Mon Aug 1 13:54:36 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3bec33b16db11c67d43bda134520a2132ff606c9
  Author: Jakob Johnson <johnsonjakob99 at gmail.com>
  Date:   2022-08-01 (Mon, 01 Aug 2022)

  Changed paths:
    M lldb/include/lldb/Target/Trace.h
    M lldb/include/lldb/Target/TraceCursor.h
    M lldb/include/lldb/Target/TraceDumper.h
    M lldb/include/lldb/lldb-forward.h
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
    M lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
    M lldb/source/Target/TraceDumper.cpp

  Log Message:
  [trace] Replace TraceCursorUP with TraceCursorSP

The use of `std::unique_ptr` with `TraceCursor` adds unnecessary complexity to adding `SBTraceCursor` bindings
Specifically, since `TraceCursor` is an abstract class there's no clean
way to provide "deep clone" semantics for `TraceCursorUP` short of
creating a pure virtual `clone()` method (afaict).

After discussing with @wallace, we decided there is no strong reason to
favor wrapping `TraceCursor` with `std::unique_ptr` over `std::shared_ptr`, thus this diff
replaces all usages of `std::unique_ptr<TraceCursor>` with `std::shared_ptr<TraceCursor>`.

This sets the stage for future diffs to introduce `SBTraceCursor`
bindings in a more clean fashion.

Test Plan:

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

More information about the All-commits mailing list