Skip to content

Commit a4446e0

Browse files
committed
PR feedback, pass string ref instead of char *
1 parent 4522448 commit a4446e0

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lldb/tools/lldb-dap/ProgressEvent.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ json::Value ProgressEvent::ToJSON() const {
117117
body.try_emplace("cancellable", false);
118118
}
119119

120-
if (m_event_type == progressUpdate) {
120+
if (m_event_type == progressUpdate)
121121
EmplaceSafeString(body, "message", m_message);
122-
}
123122

124123
std::string timestamp(llvm::formatv("{0:f9}", m_creation_time.count()));
125124
EmplaceSafeString(body, "timestamp", timestamp);
@@ -168,11 +167,10 @@ const ProgressEvent &ProgressEventManager::GetMostRecentEvent() const {
168167
return m_last_update_event ? *m_last_update_event : m_start_event;
169168
}
170169

171-
void ProgressEventManager::Update(uint64_t progress_id, const char *message,
170+
void ProgressEventManager::Update(uint64_t progress_id, llvm::StringRef message,
172171
uint64_t completed, uint64_t total) {
173-
if (std::optional<ProgressEvent> event =
174-
ProgressEvent::Create(progress_id, StringRef(message), completed,
175-
total, &GetMostRecentEvent())) {
172+
if (std::optional<ProgressEvent> event = ProgressEvent::Create(
173+
progress_id, message, completed, total, &GetMostRecentEvent())) {
176174
if (event->GetEventType() == progressEnd)
177175
m_finished = true;
178176

@@ -232,7 +230,7 @@ void ProgressEventReporter::Push(uint64_t progress_id, const char *message,
232230
m_unreported_start_events.push(event_manager);
233231
}
234232
} else {
235-
it->second->Update(progress_id, message, completed, total);
233+
it->second->Update(progress_id, StringRef(message), completed, total);
236234
if (it->second->Finished())
237235
m_event_managers.erase(it);
238236
}

lldb/tools/lldb-dap/ProgressEvent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ProgressEventManager {
9999

100100
/// Receive a new progress event for the start event and try to report it if
101101
/// appropriate.
102-
void Update(uint64_t progress_id, const char *message, uint64_t completed,
102+
void Update(uint64_t progress_id, llvm::StringRef message, uint64_t completed,
103103
uint64_t total);
104104

105105
/// \return

0 commit comments

Comments
 (0)