================
@@ -104,6 +104,19 @@ ScriptInterpreter::GetStatusFromSBError(const 
lldb::SBError &error) const {
   return Status();
 }
 
+Event *
+ScriptInterpreter::GetOpaqueTypeFromSBEvent(const lldb::SBEvent &event) const {
+  return event.m_opaque_ptr;
+}
+
+Stream *ScriptInterpreter::GetOpaqueTypeFromSBStream(
+    const lldb::SBStream &stream) const {
+  if (stream.m_opaque_up)
+    return const_cast<lldb::SBStream &>(stream).m_opaque_up.release();
----------------
bulbazord wrote:

I'm having a hard time wrapping my head around the SBStream portion of your 
patch (everything else makes sense). So we pass in a `const SBStream &` to 
`GetOpaqueTypeFromSBStream` which that takes ownership of the underlying 
`Stream *`  and returns it. What happens to the original SBStream argument? Can 
we guarantee that nothing ever tries to use it again afterwards?
It looks like the intent in `ReverseTransform` is to take ownership of the 
original user-provided stream and write its contents to some other stream 
`original_arg` after performing some kind of copy on it. Instead of taking 
ownership of the underlying stream (and invalidating its argument), why not 
just use `.get()` instead of `.release()`? The `SBStream` passed in here won't 
be invalidated and `original_arg` in `ReverseTransform` can still get the data 
out of the Python `SBStream` object.

What am I missing?

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

Reply via email to