aboutsummaryrefslogtreecommitdiff
path: root/lldb/unittests/ScriptInterpreter/Python
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2021-11-25 14:01:41 +0100
committerPavel Labath <pavel@labath.sk>2021-12-13 21:04:51 +0100
commit82de8df26f15778793dc6b1526e14779f435f2e1 (patch)
tree2afe68a74ee84b73762dce273b72631941801d39 /lldb/unittests/ScriptInterpreter/Python
parent34696e6542894ac63dbfb899b0181c539c223ef1 (diff)
downloadllvm-82de8df26f15778793dc6b1526e14779f435f2e1.zip
llvm-82de8df26f15778793dc6b1526e14779f435f2e1.tar.gz
llvm-82de8df26f15778793dc6b1526e14779f435f2e1.tar.bz2
[lldb] Clarify StructuredDataImpl ownership
StructuredDataImpl ownership semantics is unclear at best. Various structures were holding a non-owning pointer to it, with a comment that the object is owned somewhere else. From what I was able to gather that "somewhere else" was the SBStructuredData object, but I am not sure that all created object eventually made its way there. (It wouldn't matter even if they did, as we are leaking most of our SBStructuredData objects.) Since StructuredDataImpl is just a collection of two (shared) pointers, there's really no point in elaborate lifetime management, so this patch replaces all StructuredDataImpl pointers with actual objects or unique_ptrs to it. This makes it much easier to resolve SBStructuredData leaks in a follow-up patch. Differential Revision: https://reviews.llvm.org/D114791
Diffstat (limited to 'lldb/unittests/ScriptInterpreter/Python')
-rw-r--r--lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
index 1295ab2..c27fc03 100644
--- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -63,7 +63,7 @@ llvm::Expected<bool> lldb_private::LLDBSwigPythonBreakpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &sb_frame,
const lldb::BreakpointLocationSP &sb_bp_loc,
- StructuredDataImpl *args_impl) {
+ const StructuredDataImpl &args_impl) {
return false;
}
@@ -94,7 +94,7 @@ void *lldb_private::LLDBSwigPythonCreateCommandObject(
void *lldb_private::LLDBSwigPythonCreateScriptedThreadPlan(
const char *python_class_name, const char *session_dictionary_name,
- StructuredDataImpl *args_data, std::string &error_string,
+ const StructuredDataImpl &args_data, std::string &error_string,
const lldb::ThreadPlanSP &thread_plan_sp) {
return nullptr;
}
@@ -108,7 +108,7 @@ bool lldb_private::LLDBSWIGPythonCallThreadPlan(void *implementor,
void *lldb_private::LLDBSwigPythonCreateScriptedBreakpointResolver(
const char *python_class_name, const char *session_dictionary_name,
- lldb_private::StructuredDataImpl *args, const lldb::BreakpointSP &bkpt_sp) {
+ const StructuredDataImpl &args, const lldb::BreakpointSP &bkpt_sp) {
return nullptr;
}
@@ -200,14 +200,14 @@ lldb_private::LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
void *lldb_private::LLDBSwigPythonCreateScriptedProcess(
const char *python_class_name, const char *session_dictionary_name,
- const lldb::TargetSP &target_sp, StructuredDataImpl *args_impl,
+ const lldb::TargetSP &target_sp, const StructuredDataImpl &args_impl,
std::string &error_string) {
return nullptr;
}
void *lldb_private::LLDBSwigPythonCreateScriptedThread(
const char *python_class_name, const char *session_dictionary_name,
- const lldb::ProcessSP &process_sp, StructuredDataImpl *args_impl,
+ const lldb::ProcessSP &process_sp, const StructuredDataImpl &args_impl,
std::string &error_string) {
return nullptr;
}
@@ -259,8 +259,8 @@ void *lldb_private::LLDBSWIGPython_GetDynamicSetting(
void *lldb_private::LLDBSwigPythonCreateScriptedStopHook(
lldb::TargetSP target_sp, const char *python_class_name,
- const char *session_dictionary_name,
- lldb_private::StructuredDataImpl *args_impl, Status &error) {
+ const char *session_dictionary_name, const StructuredDataImpl &args_impl,
+ Status &error) {
return nullptr;
}