[Lldb-commits] [lldb] 1f7eb6f - [lldb] Make SBProgress move-only (#124843)

via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 28 14:03:21 PST 2025


Author: Alex Langford
Date: 2025-01-28T14:03:17-08:00
New Revision: 1f7eb6f403bc0e453b76d9274994d840561e96cf

URL: https://github.com/llvm/llvm-project/commit/1f7eb6f403bc0e453b76d9274994d840561e96cf
DIFF: https://github.com/llvm/llvm-project/commit/1f7eb6f403bc0e453b76d9274994d840561e96cf.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/include/lldb/API/SBProgress.h
    lldb/source/API/SBProgress.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/API/SBProgress.h b/lldb/include/lldb/API/SBProgress.h
index d2eaf0a743cb3a..d574d1d2982b96 100644
--- a/lldb/include/lldb/API/SBProgress.h
+++ b/lldb/include/lldb/API/SBProgress.h
@@ -51,6 +51,10 @@ class LLDB_API SBProgress {
   SBProgress(const char *title, const char *details, uint64_t total_units,
              SBDebugger &debugger);
 
+#ifndef SWIG
+  SBProgress(SBProgress &&rhs);
+#endif
+
   ~SBProgress();
 
   void Increment(uint64_t amount, const char *description = nullptr);
@@ -59,6 +63,9 @@ class LLDB_API SBProgress {
   lldb_private::Progress &ref() const;
 
 private:
+  SBProgress(const SBProgress &rhs) = delete;
+  const SBProgress &operator=(const SBProgress &rhs) = delete;
+
   std::unique_ptr<lldb_private::Progress> m_opaque_up;
 }; // SBProgress
 } // namespace lldb

diff  --git a/lldb/source/API/SBProgress.cpp b/lldb/source/API/SBProgress.cpp
index d6ed5f0d15fc94..e67e289a60eff4 100644
--- a/lldb/source/API/SBProgress.cpp
+++ b/lldb/source/API/SBProgress.cpp
@@ -32,6 +32,9 @@ SBProgress::SBProgress(const char *title, const char *details,
       lldb_private::Progress::Origin::eExternal);
 }
 
+SBProgress::SBProgress(SBProgress &&rhs)
+    : m_opaque_up(std::move(rhs.m_opaque_up)) {}
+
 SBProgress::~SBProgress() = default;
 
 void SBProgress::Increment(uint64_t amount, const char *description) {


        


More information about the lldb-commits mailing list