diff options
author | Enrico Granata <egranata@apple.com> | 2012-03-06 23:42:15 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2012-03-06 23:42:15 +0000 |
commit | a73b7df7de3ef7e21ca716369da33d66db79ead4 (patch) | |
tree | 45dd1817617c374d511ba4cb382a68dd21becbad /lldb/source/Core/FormatClasses.cpp | |
parent | 5022f1dffede35aa231cde3f81c65e8d9d7969fc (diff) | |
download | bcm5719-llvm-a73b7df7de3ef7e21ca716369da33d66db79ead4.tar.gz bcm5719-llvm-a73b7df7de3ef7e21ca716369da33d66db79ead4.zip |
Using the new ScriptInterpreterObject in the implementation of synthetic children to enhance type safety
Several places in the ScriptInterpreter interface used StringList objects where an std::string would suffice - Fixed
Refactoring calls that generated special-purposes functions in the Python interpreter to use helper functions instead of duplicating blobs of code
llvm-svn: 152164
Diffstat (limited to 'lldb/source/Core/FormatClasses.cpp')
-rw-r--r-- | lldb/source/Core/FormatClasses.cpp | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/lldb/source/Core/FormatClasses.cpp b/lldb/source/Core/FormatClasses.cpp index 4dd51de8a2c..d3a23d10219 100644 --- a/lldb/source/Core/FormatClasses.cpp +++ b/lldb/source/Core/FormatClasses.cpp @@ -9,20 +9,6 @@ // C Includes -#ifdef LLDB_DISABLE_PYTHON - -struct PyObject; - -#else // #ifdef LLDB_DISABLE_PYTHON - -#if defined (__APPLE__) -#include <Python/Python.h> -#else -#include <Python.h> -#endif - -#endif // #ifdef LLDB_DISABLE_PYTHON - // C++ Includes #include <ostream> @@ -269,35 +255,30 @@ SyntheticArrayView::GetDescription() TypeSyntheticImpl::FrontEnd::FrontEnd(std::string pclass, lldb::ValueObjectSP be) : SyntheticChildrenFrontEnd(be), - m_python_class(pclass) + m_python_class(pclass), + m_wrapper_sp(), + m_interpreter(NULL) { if (be.get() == NULL) - { - m_interpreter = NULL; - m_wrapper = NULL; return; - } m_interpreter = m_backend->GetTargetSP()->GetDebugger().GetCommandInterpreter().GetScriptInterpreter(); - if (m_interpreter == NULL) - m_wrapper = NULL; - else - m_wrapper = m_interpreter->CreateSyntheticScriptedProvider(m_python_class, m_backend); + if (m_interpreter != NULL) + m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class, m_backend); } TypeSyntheticImpl::FrontEnd::~FrontEnd() { - Py_XDECREF((PyObject*)m_wrapper); } lldb::ValueObjectSP TypeSyntheticImpl::FrontEnd::GetChildAtIndex (uint32_t idx, bool can_create) { - if (m_wrapper == NULL || m_interpreter == NULL) + if (!m_wrapper_sp || !m_interpreter) return lldb::ValueObjectSP(); - return m_interpreter->GetChildAtIndex(m_wrapper, idx); + return m_interpreter->GetChildAtIndex(m_wrapper_sp, idx); } std::string |