[Lldb-commits] [lldb] [lldb][NFCI] Remove EventData* parameter from BroadcastEventIfUnique (PR #79045)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 26 10:40:18 PST 2024


================
@@ -4281,25 +4281,31 @@ void Process::CalculateExecutionContext(ExecutionContext &exe_ctx) {
 //    return Host::GetArchSpecForExistingProcess (process_name);
 //}
 
+EventSP Process::CreateEventFromProcessState(uint32_t event_type) {
+  auto event_data_sp =
+      std::make_shared<ProcessEventData>(shared_from_this(), GetState());
+  return std::make_shared<Event>(event_type, event_data_sp);
+}
+
 void Process::AppendSTDOUT(const char *s, size_t len) {
   std::lock_guard<std::recursive_mutex> guard(m_stdio_communication_mutex);
   m_stdout_data.append(s, len);
-  BroadcastEventIfUnique(eBroadcastBitSTDOUT,
-                         new ProcessEventData(shared_from_this(), GetState()));
+  auto event_sp = CreateEventFromProcessState(eBroadcastBitSTDOUT);
+  BroadcastEventIfUnique(event_sp);
----------------
bulbazord wrote:

Oh, I remember why I didn't do this now! `BroadcastEventIfUnique` expects an lvalue argument but inlining the call would make it an rvalue. I don't think this matters tremendously so I'll land as-is and we can revisit as needed later.

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


More information about the lldb-commits mailing list