@@ -453,8 +453,9 @@ ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(Debugger &debugger)
453453 // Reloading modules requires a different syntax in Python 2 and Python 3.
454454 // This provides a consistent syntax no matter what version of Python.
455455 run_string.Clear ();
456- run_string.Printf (" run_one_line (%s, 'from importlib import reload as reload_module')" ,
457- m_dictionary_name.c_str ());
456+ run_string.Printf (
457+ " run_one_line (%s, 'from importlib import reload as reload_module')" ,
458+ m_dictionary_name.c_str ());
458459 PyRun_SimpleString (run_string.GetData ());
459460
460461 // WARNING: temporary code that loads Cocoa formatters - this should be done
@@ -770,21 +771,19 @@ llvm::Expected<unsigned>
770771ScriptInterpreterPythonImpl::GetMaxPositionalArgumentsForCallable (
771772 const llvm::StringRef &callable_name) {
772773 if (callable_name.empty ()) {
773- return llvm::createStringError (
774- llvm::inconvertibleErrorCode (),
775- " called with empty callable name." );
776- }
777- Locker py_lock (this , Locker::AcquireLock |
778- Locker::InitSession |
779- Locker::NoSTDIN);
780- auto dict = PythonModule::MainModule ()
781- .ResolveName <PythonDictionary>(m_dictionary_name);
774+ return llvm::createStringError (llvm::inconvertibleErrorCode (),
775+ " called with empty callable name." );
776+ }
777+ Locker py_lock (this ,
778+ Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
779+ auto dict = PythonModule::MainModule ().ResolveName <PythonDictionary>(
780+ m_dictionary_name);
782781 auto pfunc = PythonObject::ResolveNameWithDictionary<PythonCallable>(
783782 callable_name, dict);
784783 if (!pfunc.IsAllocated ()) {
785- return llvm::createStringError (
786- llvm::inconvertibleErrorCode () ,
787- " can't find callable: %s " , callable_name.str ().c_str ());
784+ return llvm::createStringError (llvm::inconvertibleErrorCode (),
785+ " can't find callable: %s " ,
786+ callable_name.str ().c_str ());
788787 }
789788 llvm::Expected<PythonCallable::ArgInfo> arg_info = pfunc.GetArgInfo ();
790789 if (!arg_info)
@@ -1266,8 +1265,7 @@ Status ScriptInterpreterPythonImpl::SetBreakpointCommandCallback(
12661265
12671266// Set a Python one-liner as the callback for the watchpoint.
12681267void ScriptInterpreterPythonImpl::SetWatchpointCommandCallback (
1269- WatchpointOptions *wp_options, const char *user_input,
1270- bool is_callback) {
1268+ WatchpointOptions *wp_options, const char *user_input, bool is_callback) {
12711269 auto data_up = std::make_unique<WatchpointOptions::CommandData>();
12721270
12731271 // It's necessary to set both user_source and script_source to the oneliner.
@@ -1293,8 +1291,7 @@ Status ScriptInterpreterPythonImpl::ExportFunctionDefinitionToInterpreter(
12931291 std::string function_def_string (function_def.CopyList ());
12941292
12951293 Status error = ExecuteMultipleLines (
1296- function_def_string.c_str (),
1297- ExecuteScriptOptions ().SetEnableIO (false ));
1294+ function_def_string.c_str (), ExecuteScriptOptions ().SetEnableIO (false ));
12981295 return error;
12991296}
13001297
@@ -2075,7 +2072,8 @@ int ScriptInterpreterPythonImpl::GetIndexOfChildWithName(
20752072 {
20762073 Locker py_lock (this ,
20772074 Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
2078- ret_val = SWIGBridge::LLDBSwigPython_GetIndexOfChildWithName (implementor, child_name);
2075+ ret_val = SWIGBridge::LLDBSwigPython_GetIndexOfChildWithName (implementor,
2076+ child_name);
20792077 }
20802078
20812079 return ret_val;
@@ -2467,7 +2465,8 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
24672465 // the lifetime of the process in which this LLDB framework is living.
24682466 const bool does_contain_executed = ExecuteOneLineWithReturn (
24692467 command_stream.GetData (),
2470- ScriptInterpreterPythonImpl::eScriptReturnTypeBool, &does_contain, exc_options);
2468+ ScriptInterpreterPythonImpl::eScriptReturnTypeBool, &does_contain,
2469+ exc_options);
24712470
24722471 const bool was_imported_globally = does_contain_executed && does_contain;
24732472 const bool was_imported_locally =
@@ -2684,7 +2683,7 @@ bool ScriptInterpreterPythonImpl::RunScriptBasedParsedCommand(
26842683 args_arr_sp->AddStringItem (entry.ref ());
26852684 }
26862685 StructuredDataImpl args_impl (args_arr_sp);
2687-
2686+
26882687 ret_val = SWIGBridge::LLDBSwigPythonCallParsedCommandObject (
26892688 static_cast <PyObject *>(impl_obj_sp->GetValue ()), debugger_sp,
26902689 args_impl, cmd_retobj, exe_ctx_ref_sp);
@@ -2786,8 +2785,7 @@ bool ScriptInterpreterPythonImpl::GetDocumentationForItem(const char *item,
27862785
27872786 if (ExecuteOneLineWithReturn (
27882787 command, ScriptInterpreter::eScriptReturnTypeCharStrOrNone,
2789- &result_ptr,
2790- ExecuteScriptOptions ().SetEnableIO (false ))) {
2788+ &result_ptr, ExecuteScriptOptions ().SetEnableIO (false ))) {
27912789 if (result_ptr)
27922790 dest.assign (result_ptr);
27932791 return true ;
@@ -2885,7 +2883,7 @@ uint32_t ScriptInterpreterPythonImpl::GetFlagsForCommandObject(
28852883 return result;
28862884}
28872885
2888- StructuredData::ObjectSP
2886+ StructuredData::ObjectSP
28892887ScriptInterpreterPythonImpl::GetOptionsForCommandObject (
28902888 StructuredData::GenericSP cmd_obj_sp) {
28912889 StructuredData::ObjectSP result = {};
@@ -2930,10 +2928,10 @@ ScriptInterpreterPythonImpl::GetOptionsForCommandObject(
29302928 PyErr_Clear ();
29312929 return {};
29322930 }
2933- return py_return.CreateStructuredObject ();
2931+ return py_return.CreateStructuredObject ();
29342932}
29352933
2936- StructuredData::ObjectSP
2934+ StructuredData::ObjectSP
29372935ScriptInterpreterPythonImpl::GetArgumentsForCommandObject (
29382936 StructuredData::GenericSP cmd_obj_sp) {
29392937 StructuredData::ObjectSP result = {};
@@ -2978,19 +2976,18 @@ ScriptInterpreterPythonImpl::GetArgumentsForCommandObject(
29782976 PyErr_Clear ();
29792977 return {};
29802978 }
2981- return py_return.CreateStructuredObject ();
2979+ return py_return.CreateStructuredObject ();
29822980}
29832981
2984- void
2985- ScriptInterpreterPythonImpl::OptionParsingStartedForCommandObject (
2982+ void ScriptInterpreterPythonImpl::OptionParsingStartedForCommandObject (
29862983 StructuredData::GenericSP cmd_obj_sp) {
29872984
29882985 Locker py_lock (this , Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
29892986
29902987 static char callee_name[] = " option_parsing_started" ;
29912988
29922989 if (!cmd_obj_sp)
2993- return ;
2990+ return ;
29942991
29952992 PythonObject implementor (PyRefType::Borrowed,
29962993 (PyObject *)cmd_obj_sp->GetValue ());
@@ -3016,10 +3013,9 @@ ScriptInterpreterPythonImpl::OptionParsingStartedForCommandObject(
30163013 if (PyErr_Occurred ())
30173014 PyErr_Clear ();
30183015
3019- // option_parsing_starting doesn't return anything, ignore anything but
3016+ // option_parsing_starting doesn't return anything, ignore anything but
30203017 // python errors.
3021- unwrapOrSetPythonException (
3022- As<bool >(implementor.CallMethod (callee_name)));
3018+ unwrapOrSetPythonException (As<bool >(implementor.CallMethod (callee_name)));
30233019
30243020 // if it fails, print the error but otherwise go on
30253021 if (PyErr_Occurred ()) {
@@ -3029,8 +3025,7 @@ ScriptInterpreterPythonImpl::OptionParsingStartedForCommandObject(
30293025 }
30303026}
30313027
3032- bool
3033- ScriptInterpreterPythonImpl::SetOptionValueForCommandObject (
3028+ bool ScriptInterpreterPythonImpl::SetOptionValueForCommandObject (
30343029 StructuredData::GenericSP cmd_obj_sp, ExecutionContext *exe_ctx,
30353030 llvm::StringRef long_option, llvm::StringRef value) {
30363031 StructuredData::ObjectSP result = {};
@@ -3065,15 +3060,15 @@ ScriptInterpreterPythonImpl::SetOptionValueForCommandObject(
30653060
30663061 if (PyErr_Occurred ())
30673062 PyErr_Clear ();
3068-
3063+
30693064 lldb::ExecutionContextRefSP exe_ctx_ref_sp;
30703065 if (exe_ctx)
30713066 exe_ctx_ref_sp.reset (new ExecutionContextRef (exe_ctx));
30723067 PythonObject ctx_ref_obj = SWIGBridge::ToSWIGWrapper (exe_ctx_ref_sp);
3073-
3074- bool py_return = unwrapOrSetPythonException (
3075- As< bool >( implementor.CallMethod (callee_name, ctx_ref_obj, long_option. str (). c_str (),
3076- value.str ().c_str ())));
3068+
3069+ bool py_return = unwrapOrSetPythonException (As< bool >(
3070+ implementor.CallMethod (callee_name, ctx_ref_obj,
3071+ long_option. str (). c_str (), value.str ().c_str ())));
30773072
30783073 // if it fails, print the error but otherwise go on
30793074 if (PyErr_Occurred ()) {
0 commit comments