[Lldb-commits] [lldb] [lldb][Progress] Separate title and details (PR #77547)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 10 12:46:40 PST 2024


================
@@ -30,18 +34,19 @@ Progress::~Progress() {
   // Make sure to always report progress completed when this object is
   // destructed so it indicates the progress dialog/activity should go away.
   std::lock_guard<std::mutex> guard(m_mutex);
-  if (!m_completed)
-    m_completed = m_total;
+  if (m_total.has_value() && !m_completed)
+    m_completed = m_total.value();
   ReportProgress();
 }
 
 void Progress::Increment(uint64_t amount, std::string update) {
   if (amount > 0) {
     std::lock_guard<std::mutex> guard(m_mutex);
+    m_details = update;
     // Watch out for unsigned overflow and make sure we don't increment too
     // much and exceed m_total.
-    if (amount > (m_total - m_completed))
-      m_completed = m_total;
+    if (m_total.has_value() && (amount > (m_total.value() - m_completed)))
+      m_completed = m_total.value();
     else
       m_completed += amount;
     ReportProgress(update);
----------------
clayborg wrote:

We are now storing any new detail into `m_details`, do we need to send this to ReportProgress now? Prior to this, this string wasn't stored anywhere but now we have a copy, so we should probably remove the parameter to this.

https://github.com/llvm/llvm-project/pull/77547


More information about the lldb-commits mailing list