================
@@ -85,6 +85,11 @@ double DecodedThread::NanosecondsRange::GetInterpolatedTime(
   return interpolate(next_range->nanos);
 }
 
+DecodedThread::TraceItemStorage::TraceItemStorage(
+    const TraceItemStorage &other) {
+  std::memcpy(this, &other, sizeof *this);
----------------
nmosier wrote:

`DecodedThread` does know which member is being used (it uses `enum 
TraceItemKind` to tag the union); however, it stores the tag separately in 
`DecodedThread::m_item_kinds` for space/alignment reasons.
I added this copy constructor for use by `std::vector<TraceItemStorage> 
DecodedThread::m_trace_data`; without it, it raises a compile error because it 
doesn't know how to copy/move `TraceItemStorage` elements when resizing the 
vector. This means that we can't add a second TraceItemKind argument to the 
copy constructor, because std::vector<TraceItemStorage> won't know how to use 
that.

https://github.com/llvm/llvm-project/pull/77252
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to