Remove std::string input arguments and replace with "const char *".

llvm-svn: 172647
This commit is contained in:
Greg Clayton 2013-01-16 19:53:55 +00:00
parent ce26df829f
commit b14bed80cb
5 changed files with 75 additions and 80 deletions

View File

@ -84,11 +84,11 @@ public:
void** pyfunct_wrapper, void** pyfunct_wrapper,
std::string& retval); std::string& retval);
typedef void* (*SWIGPythonCreateSyntheticProvider) (const std::string python_class_name, typedef void* (*SWIGPythonCreateSyntheticProvider) (const const char *python_class_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::ValueObjectSP& valobj_sp); const lldb::ValueObjectSP& valobj_sp);
typedef void* (*SWIGPythonCreateOSPlugin) (const std::string python_class_name, typedef void* (*SWIGPythonCreateOSPlugin) (const const char *python_class_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::ProcessSP& process_sp); const lldb::ProcessSP& process_sp);
@ -107,7 +107,7 @@ public:
std::string& err_msg, std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj); lldb_private::CommandReturnObject& cmd_retobj);
typedef bool (*SWIGPythonCallModuleInit) (const std::string python_module_name, typedef bool (*SWIGPythonCallModuleInit) (const const char *python_module_name,
const char *session_dictionary_name, const char *session_dictionary_name,
lldb::DebuggerSP& debugger); lldb::DebuggerSP& debugger);
@ -261,14 +261,14 @@ public:
} }
virtual lldb::ScriptInterpreterObjectSP virtual lldb::ScriptInterpreterObjectSP
CreateSyntheticScriptedProvider (std::string class_name, CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj) lldb::ValueObjectSP valobj)
{ {
return lldb::ScriptInterpreterObjectSP(); return lldb::ScriptInterpreterObjectSP();
} }
virtual lldb::ScriptInterpreterObjectSP virtual lldb::ScriptInterpreterObjectSP
CreateOSPlugin (std::string class_name, CreateOSPlugin (const char *class_name,
lldb::ProcessSP process_sp) lldb::ProcessSP process_sp)
{ {
return lldb::ScriptInterpreterObjectSP(); return lldb::ScriptInterpreterObjectSP();

View File

@ -76,11 +76,11 @@ public:
GenerateScriptAliasFunction (StringList &input, std::string& output); GenerateScriptAliasFunction (StringList &input, std::string& output);
lldb::ScriptInterpreterObjectSP lldb::ScriptInterpreterObjectSP
CreateSyntheticScriptedProvider (std::string class_name, CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj); lldb::ValueObjectSP valobj);
virtual lldb::ScriptInterpreterObjectSP virtual lldb::ScriptInterpreterObjectSP
CreateOSPlugin (std::string class_name, CreateOSPlugin (const char *class_name,
lldb::ProcessSP process_sp); lldb::ProcessSP process_sp);
virtual lldb::ScriptInterpreterObjectSP virtual lldb::ScriptInterpreterObjectSP

View File

@ -267,6 +267,8 @@ LLDBSwigPythonCallTypeScript
{ {
lldb::SBValue sb_value (valobj_sp); lldb::SBValue sb_value (valobj_sp);
retval.clear();
PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *) &sb_value, SWIGTYPE_p_lldb__SBValue, 0); PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *) &sb_value, SWIGTYPE_p_lldb__SBValue, 0);
if (ValObj_PyObj == NULL) if (ValObj_PyObj == NULL)
@ -323,14 +325,14 @@ LLDBSwigPythonCallTypeScript
SWIGEXPORT void* SWIGEXPORT void*
LLDBSwigPythonCreateSyntheticProvider LLDBSwigPythonCreateSyntheticProvider
( (
const std::string python_class_name, const char *python_class_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::ValueObjectSP& valobj_sp const lldb::ValueObjectSP& valobj_sp
) )
{ {
PyObject* retval = NULL; PyObject* retval = NULL;
if (python_class_name.empty() || !session_dictionary_name) if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
Py_RETURN_NONE; Py_RETURN_NONE;
// I do not want the SBValue to be deallocated when going out of scope because python // I do not want the SBValue to be deallocated when going out of scope because python
@ -343,7 +345,7 @@ LLDBSwigPythonCreateSyntheticProvider
if (ValObj_PyObj == NULL) if (ValObj_PyObj == NULL)
Py_RETURN_NONE; Py_RETURN_NONE;
const char* python_function_name = python_class_name.c_str(); const char* python_function_name = python_class_name;
PyObject *session_dict, *pfunc; PyObject *session_dict, *pfunc;
PyObject *pvalue; PyObject *pvalue;
@ -778,14 +780,14 @@ LLDBSwigPythonCallCommand
SWIGEXPORT void* SWIGEXPORT void*
LLDBSWIGPythonCreateOSPlugin LLDBSWIGPythonCreateOSPlugin
( (
const std::string python_class_name, const char *python_class_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::ProcessSP& process_sp const lldb::ProcessSP& process_sp
) )
{ {
PyObject* retval = NULL; PyObject* retval = NULL;
if (python_class_name.empty() || !session_dictionary_name) if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
Py_RETURN_NONE; Py_RETURN_NONE;
// I do not want the SBValue to be deallocated when going out of scope because python // I do not want the SBValue to be deallocated when going out of scope because python
@ -797,7 +799,7 @@ LLDBSWIGPythonCreateOSPlugin
if (SBProc_PyObj == NULL) if (SBProc_PyObj == NULL)
Py_RETURN_NONE; Py_RETURN_NONE;
const char* python_function_name = python_class_name.c_str(); const char* python_function_name = python_class_name;
PyObject *session_dict, *pfunc; PyObject *session_dict, *pfunc;
PyObject *pvalue; PyObject *pvalue;
@ -875,7 +877,7 @@ LLDBSWIGPythonCreateOSPlugin
SWIGEXPORT bool SWIGEXPORT bool
LLDBSwigPythonCallModuleInit LLDBSwigPythonCallModuleInit
( (
const std::string python_module_name, const char *python_module_name,
const char *session_dictionary_name, const char *session_dictionary_name,
lldb::DebuggerSP& debugger lldb::DebuggerSP& debugger
) )
@ -890,7 +892,7 @@ LLDBSwigPythonCallModuleInit
if (DebuggerObj_PyObj == NULL) if (DebuggerObj_PyObj == NULL)
return retval; return retval;
if (!(python_module_name.length()) || !session_dictionary_name) if (python_module_name == NULL || python_module_name[0] == '\0' || !session_dictionary_name)
return retval; return retval;
PyObject *session_dict, *pfunc; PyObject *session_dict, *pfunc;
@ -898,7 +900,8 @@ LLDBSwigPythonCallModuleInit
session_dict = FindSessionDictionary (session_dictionary_name); session_dict = FindSessionDictionary (session_dictionary_name);
std::string python_function_name_string = python_module_name + (".__lldb_init_module"); std::string python_function_name_string = python_module_name;
python_function_name_string += ".__lldb_init_module";
const char* python_function_name = python_function_name_string.c_str(); const char* python_function_name = python_function_name_string.c_str();
if (session_dict != NULL) if (session_dict != NULL)

View File

@ -337,7 +337,7 @@ TypeSyntheticImpl::FrontEnd::FrontEnd(std::string pclass, ValueObject &backend)
m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter(); m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
if (m_interpreter != NULL) if (m_interpreter != NULL)
m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class, backend.GetSP()); m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class.c_str(), backend.GetSP());
} }
TypeSyntheticImpl::FrontEnd::~FrontEnd() TypeSyntheticImpl::FrontEnd::~FrontEnd()

View File

@ -64,72 +64,65 @@ static ScriptInterpreter::SWIGPythonCreateOSPlugin g_swig_create_os_plugin = NUL
// on linkage-time resolution because the SWIG stuff and this file // on linkage-time resolution because the SWIG stuff and this file
// get built at different times // get built at different times
extern "C" bool extern "C" bool
LLDBSwigPythonBreakpointCallbackFunction LLDBSwigPythonBreakpointCallbackFunction (const char *python_function_name,
(
const char *python_function_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::StackFrameSP& sb_frame, const lldb::StackFrameSP& sb_frame,
const lldb::BreakpointLocationSP& sb_bp_loc const lldb::BreakpointLocationSP& sb_bp_loc);
);
extern "C" bool extern "C" bool
LLDBSwigPythonWatchpointCallbackFunction LLDBSwigPythonWatchpointCallbackFunction (const char *python_function_name,
(
const char *python_function_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::StackFrameSP& sb_frame, const lldb::StackFrameSP& sb_frame,
const lldb::WatchpointSP& sb_wp const lldb::WatchpointSP& sb_wp);
);
extern "C" bool extern "C" bool
LLDBSwigPythonCallTypeScript LLDBSwigPythonCallTypeScript (const char *python_function_name,
(
const char *python_function_name,
void *session_dictionary, void *session_dictionary,
const lldb::ValueObjectSP& valobj_sp, const lldb::ValueObjectSP& valobj_sp,
void** pyfunct_wrapper, void** pyfunct_wrapper,
std::string& retval std::string& retval);
);
extern "C" void* extern "C" void*
LLDBSwigPythonCreateSyntheticProvider LLDBSwigPythonCreateSyntheticProvider (const char *python_class_name,
(
const std::string python_class_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::ValueObjectSP& valobj_sp const lldb::ValueObjectSP& valobj_sp);
);
extern "C" uint32_t LLDBSwigPython_CalculateNumChildren (void *implementor); extern "C" uint32_t
extern "C" void* LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx); LLDBSwigPython_CalculateNumChildren (void *implementor);
extern "C" int LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name);
extern "C" void* LLDBSWIGPython_CastPyObjectToSBValue (void* data);
extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance (void* implementor);
extern "C" bool LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor);
extern "C" bool LLDBSwigPythonCallCommand extern "C" void *
( LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx);
const char *python_function_name,
extern "C" int
LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name);
extern "C" void *
LLDBSWIGPython_CastPyObjectToSBValue (void* data);
extern "C" bool
LLDBSwigPython_UpdateSynthProviderInstance (void* implementor);
extern "C" bool
LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor);
extern "C" bool
LLDBSwigPythonCallCommand (const char *python_function_name,
const char *session_dictionary_name, const char *session_dictionary_name,
lldb::DebuggerSP& debugger, lldb::DebuggerSP& debugger,
const char* args, const char* args,
std::string& err_msg, std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj lldb_private::CommandReturnObject& cmd_retobj);
);
extern "C" bool LLDBSwigPythonCallModuleInit extern "C" bool
( LLDBSwigPythonCallModuleInit (const char *python_module_name,
const std::string python_module_name,
const char *session_dictionary_name, const char *session_dictionary_name,
lldb::DebuggerSP& debugger lldb::DebuggerSP& debugger);
);
extern "C" void* LLDBSWIGPythonCreateOSPlugin extern "C" void*
( LLDBSWIGPythonCreateOSPlugin (const char *python_class_name,
const std::string python_class_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::ProcessSP& process_sp const lldb::ProcessSP& process_sp);
);
static int static int
_check_and_flush (FILE *stream) _check_and_flush (FILE *stream)
@ -1726,10 +1719,9 @@ ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, std::st
} }
lldb::ScriptInterpreterObjectSP lldb::ScriptInterpreterObjectSP
ScriptInterpreterPython::CreateOSPlugin (std::string class_name, ScriptInterpreterPython::CreateOSPlugin (const char *class_name, lldb::ProcessSP process_sp)
lldb::ProcessSP process_sp)
{ {
if (class_name.empty()) if (class_name == NULL || class_name[0] == '\0')
return lldb::ScriptInterpreterObjectSP(); return lldb::ScriptInterpreterObjectSP();
if (!process_sp) if (!process_sp)
@ -1927,10 +1919,10 @@ ScriptInterpreterPython::OSPlugin_QueryForRegisterContextData (lldb::ScriptInter
} }
lldb::ScriptInterpreterObjectSP lldb::ScriptInterpreterObjectSP
ScriptInterpreterPython::CreateSyntheticScriptedProvider (std::string class_name, ScriptInterpreterPython::CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj) lldb::ValueObjectSP valobj)
{ {
if (class_name.empty()) if (class_name == NULL || class_name[0] == '\0')
return lldb::ScriptInterpreterObjectSP(); return lldb::ScriptInterpreterObjectSP();
if (!valobj.get()) if (!valobj.get())
@ -2591,7 +2583,7 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
// if we are here, everything worked // if we are here, everything worked
// call __lldb_init_module(debugger,dict) // call __lldb_init_module(debugger,dict)
if (!g_swig_call_module_init (basename, if (!g_swig_call_module_init (basename.c_str(),
m_dictionary_name.c_str(), m_dictionary_name.c_str(),
debugger_sp)) debugger_sp))
{ {