[Lldb-commits] [lldb] [LLDB][SBProgress] Add a finalize method (PR #128966)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 26 16:24:41 PST 2025
================
@@ -40,7 +40,17 @@ SBProgress::~SBProgress() = default;
void SBProgress::Increment(uint64_t amount, const char *description) {
LLDB_INSTRUMENT_VA(amount, description);
+ if (!m_opaque_up)
+ return;
+
m_opaque_up->Increment(amount, description);
}
+void SBProgress::Finalize() {
+ if (!m_opaque_up)
+ return;
+
+ m_opaque_up.reset();
----------------
clayborg wrote:
no need to check m_opaque_up here, just call `m_opaque_up.reset();`. If it is empty already, it will do nothing. Also add a comment here to explain what is going on:
```
// The lldb_private::Progress object is designed to be RAII and send the end progress
// event when it gets destroyed. So force our contained object to be destroyed and
// send the progress end event. Clearing this object also allows all other methods to
// quickly return without doing any work if they are called after this method.
m_opaque_up.reset();
```
https://github.com/llvm/llvm-project/pull/128966
More information about the lldb-commits
mailing list