[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 16:51:12 PST 2024
================
@@ -35,25 +42,29 @@ Progress::~Progress() {
ReportProgress();
}
-void Progress::Increment(uint64_t amount, std::string update) {
+void Progress::Increment(uint64_t amount,
+ std::optional<std::string> updated_detail) {
if (amount > 0) {
std::lock_guard<std::mutex> guard(m_mutex);
+ if (updated_detail)
+ m_details = *updated_detail;
// Watch out for unsigned overflow and make sure we don't increment too
// much and exceed m_total.
- if (amount > (m_total - m_completed))
+ if (m_total && (amount > (m_total - m_completed)))
m_completed = m_total;
else
m_completed += amount;
- ReportProgress(update);
+ ReportProgress();
}
}
-void Progress::ReportProgress(std::string update) {
+void Progress::ReportProgress() {
if (!m_complete) {
// Make sure we only send one notification that indicates the progress is
- // complete.
- m_complete = m_completed == m_total;
- Debugger::ReportProgress(m_id, m_title, std::move(update), m_completed,
- m_total, m_debugger_id);
+ // complete, and only modify m_complete is m_total isn't null.
+ if (m_total)
+ m_complete = m_completed == m_total;
----------------
clayborg wrote:
No need for the if statement anymore, these two lines can just be:
```
m_complete = m_completed == m_total;
```
https://github.com/llvm/llvm-project/pull/77547
More information about the lldb-commits
mailing list