[Lldb-commits] [PATCH] D69080: eliminate one form of PythonObject::Reset()
Lawrence D'Anna via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 16 21:31:49 PDT 2019
lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, clayborg, labath, jingham.
Herald added a project: LLDB.
I'd like to eliminate all forms of Reset() and all public constructors
on these objects, so the only way to make them is with Take<> and Retain<>
and the only way to copy or move them is with actual c++ copy, move, or
assignment.
This is a simple place to start.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D69080
Files:
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -182,7 +182,8 @@
Reset(type, py_obj);
}
- PythonObject(const PythonObject &rhs) : m_py_obj(nullptr) { Reset(rhs); }
+ PythonObject(const PythonObject &rhs)
+ : PythonObject(PyRefType::Borrowed, rhs.m_py_obj) {}
PythonObject(PythonObject &&rhs) {
m_py_obj = rhs.m_py_obj;
@@ -197,13 +198,6 @@
m_py_obj = nullptr;
}
- void Reset(const PythonObject &rhs) {
- if (!rhs.IsValid())
- Reset();
- else
- Reset(PyRefType::Borrowed, rhs.m_py_obj);
- }
-
// PythonObject is implicitly convertible to PyObject *, which will call the
// wrong overload. We want to explicitly disallow this, since a PyObject
// *always* owns its reference. Therefore the overload which takes a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69080.225348.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191017/085851b9/attachment.bin>
More information about the lldb-commits
mailing list