Remove all the __repr__ methods from the API/*.h files, and put them
into python-extensions.swig, which gets included into lldb.swig, and
adds them back into the classes when swig generates it's C++ file. This
keeps the Python stuff out of the general API classes.
Also fixed a small bug in the copy constructor for SBSymbolContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114602 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBSymbolContext.cpp b/source/API/SBSymbolContext.cpp
index 4381994..ecd7d66 100644
--- a/source/API/SBSymbolContext.cpp
+++ b/source/API/SBSymbolContext.cpp
@@ -32,7 +32,12 @@
m_opaque_ap ()
{
if (rhs.IsValid())
- *m_opaque_ap = *rhs.m_opaque_ap;
+ {
+ if (m_opaque_ap.get())
+ *m_opaque_ap = *rhs.m_opaque_ap;
+ else
+ ref() = *rhs.m_opaque_ap;
+ }
}
SBSymbolContext::~SBSymbolContext ()
@@ -141,6 +146,14 @@
return *m_opaque_ap.get();
}
+lldb_private::SymbolContext&
+SBSymbolContext::ref()
+{
+ if (m_opaque_ap.get() == NULL)
+ m_opaque_ap.reset (new SymbolContext);
+ return *m_opaque_ap.get();
+}
+
lldb_private::SymbolContext *
SBSymbolContext::get() const
{
@@ -152,6 +165,7 @@
{
if (m_opaque_ap.get())
{
+ description.ref();
m_opaque_ap->GetDescription (description.get(), lldb::eDescriptionLevelFull, NULL);
}
else
@@ -159,12 +173,3 @@
return true;
}
-
-PyObject *
-SBSymbolContext::__repr__ ()
-{
- SBStream description;
- description.ref();
- GetDescription (description);
- return PyString_FromString (description.GetData());
-}