[Lldb-commits] [lldb] [lldb][progress] Correctly check total for deterministic progress (PR #79912)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 29 22:15:43 PST 2024


================
@@ -39,7 +39,7 @@ class ProgressEventData : public EventData {
   GetAsStructuredData(const Event *event_ptr);
 
   uint64_t GetID() const { return m_id; }
-  bool IsFinite() const { return m_total != UINT64_MAX; }
+  bool IsFinite() const { return m_total != 1; }
----------------
clayborg wrote:

It would be nice to actually hard code a constant value inside the progress class and use it. We are using magic numbers.
```
class Progress {
constexpr uint64_t kNonDeterministicTotal = UINT64_MAX;
```
I was also thinking that UINT64_MAX might be a better value to use than 1 because people can create valid deterministic Progress with 1 work item. So this code would be:
```
bool IsFinite() const { return m_total != kNonDeterministicTotal; }
```

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


More information about the lldb-commits mailing list