[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 13:08:36 PST 2024


================
@@ -11,15 +11,19 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/Utility/StreamString.h"
 
+#include <optional>
+
 using namespace lldb;
 using namespace lldb_private;
 
 std::atomic<uint64_t> Progress::g_id(0);
 
-Progress::Progress(std::string title, uint64_t total,
+Progress::Progress(std::string title, std::string details,
+                   std::optional<uint64_t> total,
                    lldb_private::Debugger *debugger)
-    : m_title(title), m_id(++g_id), m_completed(0), m_total(total) {
-  assert(total > 0);
+    : m_title(title), m_details(details), m_id(++g_id), m_completed(0),
+      m_total(total) {
+  assert(total == std::nullopt || total > 0);
----------------
clayborg wrote:

We need total to be non zero when there is no actual total:
```
m_total(1) { // Default to one if in case there is no valid total
// Set the actual total if we have a valid value
if (total)
  m_total = *total;
```

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


More information about the lldb-commits mailing list