Skip to content

Commit 1f7eb6f

Browse files
authored
[lldb] Make SBProgress move-only (#124843)
I wanted to clarify the semantics around SBProgress. Given the nature of Progress events, copying seems like the wrong idea. Making SBProgress move-only (like SBStream) seems like the better choice here.
1 parent c2fba02 commit 1f7eb6f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lldb/include/lldb/API/SBProgress.h

+7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class LLDB_API SBProgress {
5151
SBProgress(const char *title, const char *details, uint64_t total_units,
5252
SBDebugger &debugger);
5353

54+
#ifndef SWIG
55+
SBProgress(SBProgress &&rhs);
56+
#endif
57+
5458
~SBProgress();
5559

5660
void Increment(uint64_t amount, const char *description = nullptr);
@@ -59,6 +63,9 @@ class LLDB_API SBProgress {
5963
lldb_private::Progress &ref() const;
6064

6165
private:
66+
SBProgress(const SBProgress &rhs) = delete;
67+
const SBProgress &operator=(const SBProgress &rhs) = delete;
68+
6269
std::unique_ptr<lldb_private::Progress> m_opaque_up;
6370
}; // SBProgress
6471
} // namespace lldb

lldb/source/API/SBProgress.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ SBProgress::SBProgress(const char *title, const char *details,
3232
lldb_private::Progress::Origin::eExternal);
3333
}
3434

35+
SBProgress::SBProgress(SBProgress &&rhs)
36+
: m_opaque_up(std::move(rhs.m_opaque_up)) {}
37+
3538
SBProgress::~SBProgress() = default;
3639

3740
void SBProgress::Increment(uint64_t amount, const char *description) {

0 commit comments

Comments
 (0)