[Lldb-commits] [PATCH] D114259: [lldb] Fix [some] leaks in python bindings

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 19 09:55:15 PST 2021


labath added inline comments.


================
Comment at: lldb/bindings/python/python-swigsafecast.swig:61-67
+PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBValue> value_sb) {
+  return ToSWIGHelper(value_sb.release(), SWIGTYPE_p_lldb__SBValue);
+}
+
+PythonObject ToSWIGWrapper(lldb::ValueObjectSP value_sp) {
+  return ToSWIGWrapper(std::make_unique<lldb::SBValue>(std::move(value_sp)));
+}
----------------
I have two of these, because one of the functions wants to modify the SB object before passing it to python. It's not a super common use case, but I think there will be a couple more of these. I have also considered having a function returning a `(PythonObject, SBValue*)` pair, but it seemed more complicated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114259/new/

https://reviews.llvm.org/D114259



More information about the lldb-commits mailing list