aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2021-02-18 10:37:30 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2021-02-18 10:38:54 -0800
commit612384f6e01194a4689b6663f039145b3d01ddce (patch)
tree7298051461938c7985aed0ce353687d6fbe73ba5 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
parente57bd1ff4fb65208cb3060b62e1c48aa0aac623f (diff)
downloadllvm-612384f6e01194a4689b6663f039145b3d01ddce.zip
llvm-612384f6e01194a4689b6663f039145b3d01ddce.tar.gz
llvm-612384f6e01194a4689b6663f039145b3d01ddce.tar.bz2
[lldb] Remove unused code in ScriptInterpreterPython
Remove the unused code I noticed when working on d6e80578fc5e and do some other minor cleanups in the vicinity.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 68409b7..b3f7206 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2877,7 +2877,7 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
bool does_contain = false;
// this call will succeed if the module was ever imported in any Debugger
// in the lifetime of the process in which this LLDB framework is living
- bool was_imported_globally =
+ const bool was_imported_globally =
(ExecuteOneLineWithReturn(
command_stream.GetData(),
ScriptInterpreterPythonImpl::eScriptReturnTypeBool, &does_contain,
@@ -2885,20 +2885,15 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
.SetEnableIO(false)
.SetSetLLDBGlobals(false)) &&
does_contain);
- // this call will fail if the module was not imported in this Debugger
- // before
- command_stream.Clear();
- command_stream.Printf("sys.getrefcount(%s)", module_name.c_str());
- bool was_imported_locally = GetSessionDictionary()
- .GetItemForKey(PythonString(module_name))
- .IsAllocated();
-
- bool was_imported = (was_imported_globally || was_imported_locally);
+ const bool was_imported_locally =
+ GetSessionDictionary()
+ .GetItemForKey(PythonString(module_name))
+ .IsAllocated();
// now actually do the import
command_stream.Clear();
- if (was_imported) {
+ if (was_imported_globally || was_imported_locally) {
if (!was_imported_locally)
command_stream.Printf("import %s ; reload_module(%s)",
module_name.c_str(), module_name.c_str());