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,
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 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 lldb::ProcessSP& process_sp);
@ -107,7 +107,7 @@ public:
std::string& err_msg,
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,
lldb::DebuggerSP& debugger);
@ -261,14 +261,14 @@ public:
}
virtual lldb::ScriptInterpreterObjectSP
CreateSyntheticScriptedProvider (std::string class_name,
CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj)
{
return lldb::ScriptInterpreterObjectSP();
}
virtual lldb::ScriptInterpreterObjectSP
CreateOSPlugin (std::string class_name,
CreateOSPlugin (const char *class_name,
lldb::ProcessSP process_sp)
{
return lldb::ScriptInterpreterObjectSP();

View File

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

View File

@ -267,6 +267,8 @@ LLDBSwigPythonCallTypeScript
{
lldb::SBValue sb_value (valobj_sp);
retval.clear();
PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *) &sb_value, SWIGTYPE_p_lldb__SBValue, 0);
if (ValObj_PyObj == NULL)
@ -323,14 +325,14 @@ LLDBSwigPythonCallTypeScript
SWIGEXPORT void*
LLDBSwigPythonCreateSyntheticProvider
(
const std::string python_class_name,
const char *python_class_name,
const char *session_dictionary_name,
const lldb::ValueObjectSP& valobj_sp
)
{
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;
// 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)
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 *pvalue;
@ -778,14 +780,14 @@ LLDBSwigPythonCallCommand
SWIGEXPORT void*
LLDBSWIGPythonCreateOSPlugin
(
const std::string python_class_name,
const char *python_class_name,
const char *session_dictionary_name,
const lldb::ProcessSP& process_sp
)
{
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;
// 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)
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 *pvalue;
@ -875,7 +877,7 @@ LLDBSWIGPythonCreateOSPlugin
SWIGEXPORT bool
LLDBSwigPythonCallModuleInit
(
const std::string python_module_name,
const char *python_module_name,
const char *session_dictionary_name,
lldb::DebuggerSP& debugger
)
@ -890,7 +892,7 @@ LLDBSwigPythonCallModuleInit
if (DebuggerObj_PyObj == NULL)
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;
PyObject *session_dict, *pfunc;
@ -898,7 +900,8 @@ LLDBSwigPythonCallModuleInit
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();
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();
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()

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
// get built at different times
extern "C" bool
LLDBSwigPythonBreakpointCallbackFunction
(
const char *python_function_name,
const char *session_dictionary_name,
const lldb::StackFrameSP& sb_frame,
const lldb::BreakpointLocationSP& sb_bp_loc
);
LLDBSwigPythonBreakpointCallbackFunction (const char *python_function_name,
const char *session_dictionary_name,
const lldb::StackFrameSP& sb_frame,
const lldb::BreakpointLocationSP& sb_bp_loc);
extern "C" bool
LLDBSwigPythonWatchpointCallbackFunction
(
const char *python_function_name,
const char *session_dictionary_name,
const lldb::StackFrameSP& sb_frame,
const lldb::WatchpointSP& sb_wp
);
LLDBSwigPythonWatchpointCallbackFunction (const char *python_function_name,
const char *session_dictionary_name,
const lldb::StackFrameSP& sb_frame,
const lldb::WatchpointSP& sb_wp);
extern "C" bool
LLDBSwigPythonCallTypeScript
(
const char *python_function_name,
void *session_dictionary,
const lldb::ValueObjectSP& valobj_sp,
void** pyfunct_wrapper,
std::string& retval
);
LLDBSwigPythonCallTypeScript (const char *python_function_name,
void *session_dictionary,
const lldb::ValueObjectSP& valobj_sp,
void** pyfunct_wrapper,
std::string& retval);
extern "C" void*
LLDBSwigPythonCreateSyntheticProvider
(
const std::string python_class_name,
const char *session_dictionary_name,
const lldb::ValueObjectSP& valobj_sp
);
LLDBSwigPythonCreateSyntheticProvider (const char *python_class_name,
const char *session_dictionary_name,
const lldb::ValueObjectSP& valobj_sp);
extern "C" uint32_t LLDBSwigPython_CalculateNumChildren (void *implementor);
extern "C" void* LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx);
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" uint32_t
LLDBSwigPython_CalculateNumChildren (void *implementor);
extern "C" bool LLDBSwigPythonCallCommand
(
const char *python_function_name,
const char *session_dictionary_name,
lldb::DebuggerSP& debugger,
const char* args,
std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj
);
extern "C" void *
LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx);
extern "C" bool LLDBSwigPythonCallModuleInit
(
const std::string python_module_name,
const char *session_dictionary_name,
lldb::DebuggerSP& debugger
);
extern "C" int
LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name);
extern "C" void* LLDBSWIGPythonCreateOSPlugin
(
const std::string python_class_name,
const char *session_dictionary_name,
const lldb::ProcessSP& process_sp
);
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,
lldb::DebuggerSP& debugger,
const char* args,
std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj);
extern "C" bool
LLDBSwigPythonCallModuleInit (const char *python_module_name,
const char *session_dictionary_name,
lldb::DebuggerSP& debugger);
extern "C" void*
LLDBSWIGPythonCreateOSPlugin (const char *python_class_name,
const char *session_dictionary_name,
const lldb::ProcessSP& process_sp);
static int
_check_and_flush (FILE *stream)
@ -1726,10 +1719,9 @@ ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, std::st
}
lldb::ScriptInterpreterObjectSP
ScriptInterpreterPython::CreateOSPlugin (std::string class_name,
lldb::ProcessSP process_sp)
ScriptInterpreterPython::CreateOSPlugin (const char *class_name, lldb::ProcessSP process_sp)
{
if (class_name.empty())
if (class_name == NULL || class_name[0] == '\0')
return lldb::ScriptInterpreterObjectSP();
if (!process_sp)
@ -1927,10 +1919,10 @@ ScriptInterpreterPython::OSPlugin_QueryForRegisterContextData (lldb::ScriptInter
}
lldb::ScriptInterpreterObjectSP
ScriptInterpreterPython::CreateSyntheticScriptedProvider (std::string class_name,
ScriptInterpreterPython::CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj)
{
if (class_name.empty())
if (class_name == NULL || class_name[0] == '\0')
return lldb::ScriptInterpreterObjectSP();
if (!valobj.get())
@ -2591,9 +2583,9 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
// if we are here, everything worked
// call __lldb_init_module(debugger,dict)
if (!g_swig_call_module_init (basename,
m_dictionary_name.c_str(),
debugger_sp))
if (!g_swig_call_module_init (basename.c_str(),
m_dictionary_name.c_str(),
debugger_sp))
{
error.SetErrorString("calling __lldb_init_module failed");
return false;