<rdar://problem/10062621>
New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association.
This provides SB classes for each of the main object types involved in providing formatter support:
SBTypeCategory
SBTypeFilter
SBTypeFormat
SBTypeSummary
SBTypeSynthetic
plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions
For naming consistency, this patch also renames a lot of formatters-related classes.
Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side.
The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer.
An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes.
Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150558 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 9c2eea0..f98ca35 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -25,6 +25,15 @@
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
+#include "lldb/API/SBTypeCategory.h"
+#include "lldb/API/SBTypeFormat.h"
+#include "lldb/API/SBTypeFilter.h"
+#include "lldb/API/SBTypeNameSpecifier.h"
+#include "lldb/API/SBTypeSummary.h"
+#include "lldb/API/SBTypeSynthetic.h"
+
+
+#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
#include "lldb/Interpreter/Args.h"
@@ -1054,3 +1063,140 @@
if (m_opaque_sp)
m_opaque_sp->SetCloseInputOnEOF (b);
}
+
+SBTypeCategory
+SBDebugger::GetCategory (const char* category_name)
+{
+ if (!category_name || *category_name == 0)
+ return SBTypeCategory();
+
+ TypeCategoryImplSP category_sp;
+
+ if (DataVisualization::Categories::GetCategory(ConstString(category_name), category_sp, false))
+ return SBTypeCategory(category_sp);
+ else
+ return SBTypeCategory();
+}
+
+SBTypeCategory
+SBDebugger::CreateCategory (const char* category_name)
+{
+ if (!category_name || *category_name == 0)
+ return SBTypeCategory();
+
+ TypeCategoryImplSP category_sp;
+
+ if (DataVisualization::Categories::GetCategory(ConstString(category_name), category_sp, true))
+ return SBTypeCategory(category_sp);
+ else
+ return SBTypeCategory();
+}
+
+bool
+SBDebugger::DeleteCategory (const char* category_name)
+{
+ if (!category_name || *category_name == 0)
+ return false;
+
+ return DataVisualization::Categories::Delete(ConstString(category_name));
+}
+
+uint32_t
+SBDebugger::GetNumCategories()
+{
+ return DataVisualization::Categories::GetCount();
+}
+
+SBTypeCategory
+SBDebugger::GetCategoryAtIndex (uint32_t index)
+{
+ return SBTypeCategory(DataVisualization::Categories::GetCategoryAtIndex(index));
+}
+
+SBTypeCategory
+SBDebugger::GetDefaultCategory()
+{
+ return GetCategory("default");
+}
+
+SBTypeFormat
+SBDebugger::GetFormatForType (SBTypeNameSpecifier type_name)
+{
+ SBTypeCategory default_category_sb = GetDefaultCategory();
+ if (default_category_sb.GetEnabled())
+ return default_category_sb.GetFormatForType(type_name);
+ return SBTypeFormat();
+}
+
+SBTypeSummary
+SBDebugger::GetSummaryForType (SBTypeNameSpecifier type_name)
+{
+ SBTypeSummary summary_chosen;
+ uint32_t num_categories = GetNumCategories();
+ SBTypeCategory category_sb;
+ uint32_t prio_category = UINT32_MAX;
+ for (uint32_t category_id = 0;
+ category_id < num_categories;
+ category_id++)
+ {
+ category_sb = GetCategoryAtIndex(category_id);
+ if (category_sb.GetEnabled() == false)
+ continue;
+ SBTypeSummary summary_current = category_sb.GetSummaryForType(type_name);
+ if (summary_current.IsValid() && (summary_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
+ {
+ prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
+ summary_chosen = summary_current;
+ }
+ }
+ return summary_chosen;
+}
+
+SBTypeFilter
+SBDebugger::GetFilterForType (SBTypeNameSpecifier type_name)
+{
+ SBTypeFilter filter_chosen;
+ uint32_t num_categories = GetNumCategories();
+ SBTypeCategory category_sb;
+ uint32_t prio_category = UINT32_MAX;
+ for (uint32_t category_id = 0;
+ category_id < num_categories;
+ category_id++)
+ {
+ category_sb = GetCategoryAtIndex(category_id);
+ if (category_sb.GetEnabled() == false)
+ continue;
+ SBTypeFilter filter_current = category_sb.GetFilterForType(type_name);
+ if (filter_current.IsValid() && (filter_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
+ {
+ prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
+ filter_chosen = filter_current;
+ }
+ }
+ return filter_chosen;
+}
+
+SBTypeSynthetic
+SBDebugger::GetSyntheticForType (SBTypeNameSpecifier type_name)
+{
+ SBTypeSynthetic synth_chosen;
+ uint32_t num_categories = GetNumCategories();
+ SBTypeCategory category_sb;
+ uint32_t prio_category = UINT32_MAX;
+ for (uint32_t category_id = 0;
+ category_id < num_categories;
+ category_id++)
+ {
+ category_sb = GetCategoryAtIndex(category_id);
+ if (category_sb.GetEnabled() == false)
+ continue;
+ SBTypeSynthetic synth_current = category_sb.GetSyntheticForType(type_name);
+ if (synth_current.IsValid() && (synth_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
+ {
+ prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
+ synth_chosen = synth_current;
+ }
+ }
+ return synth_chosen;
+}
+
diff --git a/source/API/SBTypeCategory.cpp b/source/API/SBTypeCategory.cpp
new file mode 100644
index 0000000..b76f844
--- /dev/null
+++ b/source/API/SBTypeCategory.cpp
@@ -0,0 +1,556 @@
+//===-- SBTypeCategory.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBTypeCategory.h"
+
+#include "lldb/API/SBTypeFilter.h"
+#include "lldb/API/SBTypeFormat.h"
+#include "lldb/API/SBTypeSummary.h"
+#include "lldb/API/SBTypeSynthetic.h"
+#include "lldb/API/SBTypeNameSpecifier.h"
+#include "lldb/API/SBStream.h"
+
+#include "lldb/Core/DataVisualization.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+typedef std::pair<lldb::TypeCategoryImplSP,user_id_t> ImplType;
+
+SBTypeCategory::SBTypeCategory() :
+m_opaque_sp()
+{
+}
+
+SBTypeCategory::SBTypeCategory (const char* name) :
+m_opaque_sp()
+{
+ DataVisualization::Categories::GetCategory(ConstString(name), m_opaque_sp);
+}
+
+SBTypeCategory::SBTypeCategory (const lldb::SBTypeCategory &rhs) :
+m_opaque_sp(rhs.m_opaque_sp)
+{
+}
+
+SBTypeCategory::~SBTypeCategory ()
+{
+}
+
+bool
+SBTypeCategory::IsValid() const
+{
+ return (m_opaque_sp.get() != NULL);
+}
+
+bool
+SBTypeCategory::GetEnabled ()
+{
+ if (!IsValid())
+ return false;
+ return m_opaque_sp->IsEnabled();
+}
+
+void
+SBTypeCategory::SetEnabled (bool enabled)
+{
+ if (!IsValid())
+ return;
+ if (enabled)
+ DataVisualization::Categories::Enable(m_opaque_sp);
+ else
+ DataVisualization::Categories::Disable(m_opaque_sp);
+}
+
+const char*
+SBTypeCategory::GetName()
+{
+ if (!IsValid())
+ return false;
+ return m_opaque_sp->GetName();
+}
+
+uint32_t
+SBTypeCategory::GetNumFormats ()
+{
+ if (!IsDefaultCategory())
+ return 0;
+
+ return DataVisualization::ValueFormats::GetCount();
+}
+
+uint32_t
+SBTypeCategory::GetNumSummaries ()
+{
+ if (!IsValid())
+ return 0;
+ return m_opaque_sp->GetSummaryNavigator()->GetCount() + m_opaque_sp->GetRegexSummaryNavigator()->GetCount();
+}
+
+uint32_t
+SBTypeCategory::GetNumFilters ()
+{
+ if (!IsValid())
+ return 0;
+ return m_opaque_sp->GetFilterNavigator()->GetCount() + m_opaque_sp->GetRegexFilterNavigator()->GetCount();
+}
+
+uint32_t
+SBTypeCategory::GetNumSynthetics ()
+{
+ if (!IsValid())
+ return 0;
+ return m_opaque_sp->GetSyntheticNavigator()->GetCount() + m_opaque_sp->GetRegexSyntheticNavigator()->GetCount();
+}
+
+lldb::SBTypeNameSpecifier
+SBTypeCategory::GetTypeNameSpecifierForFilterAtIndex (uint32_t index)
+{
+ if (!IsValid())
+ return SBTypeNameSpecifier();
+ return SBTypeNameSpecifier(m_opaque_sp->GetTypeNameSpecifierForFilterAtIndex(index));
+}
+
+lldb::SBTypeNameSpecifier
+SBTypeCategory::GetTypeNameSpecifierForFormatAtIndex (uint32_t index)
+{
+ if (!IsDefaultCategory())
+ return SBTypeNameSpecifier();
+ return SBTypeNameSpecifier(DataVisualization::ValueFormats::GetTypeNameSpecifierForFormatAtIndex(index));
+}
+
+lldb::SBTypeNameSpecifier
+SBTypeCategory::GetTypeNameSpecifierForSummaryAtIndex (uint32_t index)
+{
+ if (!IsValid())
+ return SBTypeNameSpecifier();
+ return SBTypeNameSpecifier(m_opaque_sp->GetTypeNameSpecifierForSummaryAtIndex(index));
+}
+
+lldb::SBTypeNameSpecifier
+SBTypeCategory::GetTypeNameSpecifierForSyntheticAtIndex (uint32_t index)
+{
+ if (!IsValid())
+ return SBTypeNameSpecifier();
+ return SBTypeNameSpecifier(m_opaque_sp->GetTypeNameSpecifierForSyntheticAtIndex(index));
+}
+
+SBTypeFilter
+SBTypeCategory::GetFilterForType (SBTypeNameSpecifier spec)
+{
+ if (!IsValid())
+ return SBTypeFilter();
+
+ if (!spec.IsValid())
+ return SBTypeFilter();
+
+ lldb::SyntheticChildrenSP children_sp;
+
+ if (spec.IsRegex())
+ m_opaque_sp->GetRegexFilterNavigator()->GetExact(ConstString(spec.GetName()), children_sp);
+ else
+ m_opaque_sp->GetFilterNavigator()->GetExact(ConstString(spec.GetName()), children_sp);
+
+ if (!children_sp)
+ return lldb::SBTypeFilter();
+
+ TypeFilterImplSP filter_sp = std::tr1::static_pointer_cast<TypeFilterImpl>(children_sp);
+
+ return lldb::SBTypeFilter(filter_sp);
+
+}
+SBTypeFormat
+SBTypeCategory::GetFormatForType (SBTypeNameSpecifier spec)
+{
+ if (!IsDefaultCategory())
+ return SBTypeFormat();
+
+ if (!spec.IsValid())
+ return SBTypeFormat();
+
+ if (spec.IsRegex())
+ return SBTypeFormat();
+
+ return SBTypeFormat(DataVisualization::ValueFormats::GetFormat(ConstString(spec.GetName())));
+}
+
+SBTypeSummary
+SBTypeCategory::GetSummaryForType (SBTypeNameSpecifier spec)
+{
+ if (!IsValid())
+ return SBTypeSummary();
+
+ if (!spec.IsValid())
+ return SBTypeSummary();
+
+ lldb::TypeSummaryImplSP summary_sp;
+
+ if (spec.IsRegex())
+ m_opaque_sp->GetRegexSummaryNavigator()->GetExact(ConstString(spec.GetName()), summary_sp);
+ else
+ m_opaque_sp->GetSummaryNavigator()->GetExact(ConstString(spec.GetName()), summary_sp);
+
+ if (!summary_sp)
+ return lldb::SBTypeSummary();
+
+ return lldb::SBTypeSummary(summary_sp);
+}
+
+SBTypeSynthetic
+SBTypeCategory::GetSyntheticForType (SBTypeNameSpecifier spec)
+{
+ if (!IsValid())
+ return SBTypeSynthetic();
+
+ if (!spec.IsValid())
+ return SBTypeSynthetic();
+
+ lldb::SyntheticChildrenSP children_sp;
+
+ if (spec.IsRegex())
+ m_opaque_sp->GetRegexSyntheticNavigator()->GetExact(ConstString(spec.GetName()), children_sp);
+ else
+ m_opaque_sp->GetSyntheticNavigator()->GetExact(ConstString(spec.GetName()), children_sp);
+
+ if (!children_sp)
+ return lldb::SBTypeSynthetic();
+
+ TypeSyntheticImplSP synth_sp = std::tr1::static_pointer_cast<TypeSyntheticImpl>(children_sp);
+
+ return lldb::SBTypeSynthetic(synth_sp);
+}
+
+SBTypeFilter
+SBTypeCategory::GetFilterAtIndex (uint32_t index)
+{
+ if (!IsValid())
+ return SBTypeFilter();
+ lldb::SyntheticChildrenSP children_sp = m_opaque_sp->GetSyntheticAtIndex((index));
+
+ if (!children_sp.get())
+ return lldb::SBTypeFilter();
+
+ TypeFilterImplSP filter_sp = std::tr1::static_pointer_cast<TypeFilterImpl>(children_sp);
+
+ return lldb::SBTypeFilter(filter_sp);
+}
+
+SBTypeFormat
+SBTypeCategory::GetFormatAtIndex (uint32_t index)
+{
+ if (!IsDefaultCategory())
+ return SBTypeFormat();
+ return SBTypeFormat(DataVisualization::ValueFormats::GetFormatAtIndex((index)));
+}
+
+SBTypeSummary
+SBTypeCategory::GetSummaryAtIndex (uint32_t index)
+{
+ if (!IsValid())
+ return SBTypeSummary();
+ return SBTypeSummary(m_opaque_sp->GetSummaryAtIndex((index)));
+}
+
+SBTypeSynthetic
+SBTypeCategory::GetSyntheticAtIndex (uint32_t index)
+{
+ if (!IsValid())
+ return SBTypeSynthetic();
+ lldb::SyntheticChildrenSP children_sp = m_opaque_sp->GetSyntheticAtIndex((index));
+
+ if (!children_sp.get())
+ return lldb::SBTypeSynthetic();
+
+ TypeSyntheticImplSP synth_sp = std::tr1::static_pointer_cast<TypeSyntheticImpl>(children_sp);
+
+ return lldb::SBTypeSynthetic(synth_sp);
+}
+
+bool
+SBTypeCategory::AddTypeFormat (SBTypeNameSpecifier type_name,
+ SBTypeFormat format)
+{
+ if (!IsDefaultCategory())
+ return false;
+
+ if (!type_name.IsValid())
+ return false;
+
+ if (!format.IsValid())
+ return false;
+
+ if (type_name.IsRegex())
+ return false;
+
+ DataVisualization::ValueFormats::Add(ConstString(type_name.GetName()), format.GetSP());
+
+ return true;
+}
+
+bool
+SBTypeCategory::DeleteTypeFormat (SBTypeNameSpecifier type_name)
+{
+ if (!IsDefaultCategory())
+ return false;
+
+ if (!type_name.IsValid())
+ return false;
+
+ if (type_name.IsRegex())
+ return false;
+
+ return DataVisualization::ValueFormats::Delete(ConstString(type_name.GetName()));
+}
+
+bool
+SBTypeCategory::AddTypeSummary (SBTypeNameSpecifier type_name,
+ SBTypeSummary summary)
+{
+ if (!IsValid())
+ return false;
+
+ if (!type_name.IsValid())
+ return false;
+
+ if (!summary.IsValid())
+ return false;
+
+ // FIXME: we need to iterate over all the Debugger objects and have each of them contain a copy of the function
+ // since we currently have formatters live in a global space, while Python code lives in a specific Debugger-related environment
+ // this should eventually be fixed by deciding a final location in the LLDB object space for formatters
+ if (summary.IsFunctionCode())
+ {
+ void *name_token = (void*)ConstString(type_name.GetName()).GetCString();
+ const char* script = summary.GetData();
+ StringList input; input.SplitIntoLines(script, strlen(script));
+ uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers();
+ bool need_set = true;
+ for (uint32_t j = 0;
+ j < num_debuggers;
+ j++)
+ {
+ DebuggerSP debugger_sp = lldb_private::Debugger::GetDebuggerAtIndex(j);
+ if (debugger_sp)
+ {
+ ScriptInterpreter* interpreter_ptr = debugger_sp->GetCommandInterpreter().GetScriptInterpreter();
+ if (interpreter_ptr)
+ {
+ StringList output;
+ if (interpreter_ptr->GenerateTypeScriptFunction(input, output, name_token) && output.GetSize() > 0)
+ {
+ if (need_set)
+ {
+ need_set = false;
+ summary.SetFunctionName(output.GetStringAtIndex(0));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (type_name.IsRegex())
+ m_opaque_sp->GetRegexSummaryNavigator()->Add(lldb::RegularExpressionSP(new RegularExpression(type_name.GetName())), summary.GetSP());
+ else
+ m_opaque_sp->GetSummaryNavigator()->Add(ConstString(type_name.GetName()), summary.GetSP());
+
+ return true;
+}
+
+bool
+SBTypeCategory::DeleteTypeSummary (SBTypeNameSpecifier type_name)
+{
+ if (!IsValid())
+ return false;
+
+ if (!type_name.IsValid())
+ return false;
+
+ if (type_name.IsRegex())
+ return m_opaque_sp->GetRegexSummaryNavigator()->Delete(ConstString(type_name.GetName()));
+ else
+ return m_opaque_sp->GetSummaryNavigator()->Delete(ConstString(type_name.GetName()));
+}
+
+bool
+SBTypeCategory::AddTypeFilter (SBTypeNameSpecifier type_name,
+ SBTypeFilter filter)
+{
+ if (!IsValid())
+ return false;
+
+ if (!type_name.IsValid())
+ return false;
+
+ if (!filter.IsValid())
+ return false;
+
+ if (type_name.IsRegex())
+ m_opaque_sp->GetRegexFilterNavigator()->Add(lldb::RegularExpressionSP(new RegularExpression(type_name.GetName())), filter.GetSP());
+ else
+ m_opaque_sp->GetFilterNavigator()->Add(ConstString(type_name.GetName()), filter.GetSP());
+
+ return true;
+}
+
+bool
+SBTypeCategory::DeleteTypeFilter (SBTypeNameSpecifier type_name)
+{
+ if (!IsValid())
+ return false;
+
+ if (!type_name.IsValid())
+ return false;
+
+ if (type_name.IsRegex())
+ return m_opaque_sp->GetRegexFilterNavigator()->Delete(ConstString(type_name.GetName()));
+ else
+ return m_opaque_sp->GetFilterNavigator()->Delete(ConstString(type_name.GetName()));
+}
+
+bool
+SBTypeCategory::AddTypeSynthetic (SBTypeNameSpecifier type_name,
+ SBTypeSynthetic synth)
+{
+ if (!IsValid())
+ return false;
+
+ if (!type_name.IsValid())
+ return false;
+
+ if (!synth.IsValid())
+ return false;
+
+ // FIXME: we need to iterate over all the Debugger objects and have each of them contain a copy of the function
+ // since we currently have formatters live in a global space, while Python code lives in a specific Debugger-related environment
+ // this should eventually be fixed by deciding a final location in the LLDB object space for formatters
+ if (synth.IsClassCode())
+ {
+ void *name_token = (void*)ConstString(type_name.GetName()).GetCString();
+ const char* script = synth.GetData();
+ StringList input; input.SplitIntoLines(script, strlen(script));
+ uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers();
+ bool need_set = true;
+ for (uint32_t j = 0;
+ j < num_debuggers;
+ j++)
+ {
+ DebuggerSP debugger_sp = lldb_private::Debugger::GetDebuggerAtIndex(j);
+ if (debugger_sp)
+ {
+ ScriptInterpreter* interpreter_ptr = debugger_sp->GetCommandInterpreter().GetScriptInterpreter();
+ if (interpreter_ptr)
+ {
+ StringList output;
+ if (interpreter_ptr->GenerateTypeSynthClass(input, output, name_token) && output.GetSize() > 0)
+ {
+ if (need_set)
+ {
+ need_set = false;
+ synth.SetClassName(output.GetStringAtIndex(0));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (type_name.IsRegex())
+ m_opaque_sp->GetRegexSyntheticNavigator()->Add(lldb::RegularExpressionSP(new RegularExpression(type_name.GetName())), synth.GetSP());
+ else
+ m_opaque_sp->GetSyntheticNavigator()->Add(ConstString(type_name.GetName()), synth.GetSP());
+
+ return true;
+}
+
+bool
+SBTypeCategory::DeleteTypeSynthetic (SBTypeNameSpecifier type_name)
+{
+ if (!IsValid())
+ return false;
+
+ if (!type_name.IsValid())
+ return false;
+
+ if (type_name.IsRegex())
+ return m_opaque_sp->GetRegexSyntheticNavigator()->Delete(ConstString(type_name.GetName()));
+ else
+ return m_opaque_sp->GetSyntheticNavigator()->Delete(ConstString(type_name.GetName()));
+}
+
+bool
+SBTypeCategory::GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level)
+{
+ if (!IsValid())
+ return false;
+ description.Printf("Category name: %s\n",GetName());
+ return true;
+}
+
+lldb::SBTypeCategory &
+SBTypeCategory::operator = (const lldb::SBTypeCategory &rhs)
+{
+ if (this != &rhs)
+ {
+ m_opaque_sp = rhs.m_opaque_sp;
+ }
+ return *this;
+}
+
+bool
+SBTypeCategory::operator == (lldb::SBTypeCategory &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
+
+}
+
+bool
+SBTypeCategory::operator != (lldb::SBTypeCategory &rhs)
+{
+ if (IsValid() == false)
+ return rhs.IsValid();
+
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
+}
+
+lldb::TypeCategoryImplSP
+SBTypeCategory::GetSP ()
+{
+ if (!IsValid())
+ return lldb::TypeCategoryImplSP();
+ return m_opaque_sp;
+}
+
+void
+SBTypeCategory::SetSP (const lldb::TypeCategoryImplSP &typecategory_impl_sp)
+{
+ m_opaque_sp = typecategory_impl_sp;
+}
+
+SBTypeCategory::SBTypeCategory (const lldb::TypeCategoryImplSP &typecategory_impl_sp) :
+m_opaque_sp(typecategory_impl_sp)
+{
+}
+
+bool
+SBTypeCategory::IsDefaultCategory()
+{
+ if (!IsValid())
+ return false;
+
+ return (strcmp(m_opaque_sp->GetName(),"default") == 0);
+}
+
diff --git a/source/API/SBTypeFilter.cpp b/source/API/SBTypeFilter.cpp
new file mode 100644
index 0000000..50ecc25
--- /dev/null
+++ b/source/API/SBTypeFilter.cpp
@@ -0,0 +1,197 @@
+//===-- SBTypeFilter.cpp ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBTypeFilter.h"
+
+#include "lldb/API/SBStream.h"
+
+#include "lldb/Core/DataVisualization.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBTypeFilter::SBTypeFilter() :
+m_opaque_sp()
+{
+}
+
+SBTypeFilter::SBTypeFilter (uint32_t options)
+: m_opaque_sp(TypeFilterImplSP(new TypeFilterImpl(options)))
+{
+}
+
+SBTypeFilter::SBTypeFilter (const lldb::SBTypeFilter &rhs) :
+m_opaque_sp(rhs.m_opaque_sp)
+{
+}
+
+SBTypeFilter::~SBTypeFilter ()
+{
+}
+
+bool
+SBTypeFilter::IsValid() const
+{
+ return m_opaque_sp.get() != NULL;
+}
+
+uint32_t
+SBTypeFilter::GetOptions()
+{
+ if (IsValid())
+ return m_opaque_sp->GetOptions();
+ return 0;
+}
+
+void
+SBTypeFilter::SetOptions (uint32_t value)
+{
+ if (CopyOnWrite_Impl())
+ m_opaque_sp->SetOptions(value);
+}
+
+bool
+SBTypeFilter::GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level)
+{
+ if (!IsValid())
+ return false;
+ else {
+ description.Printf("%s\n",
+ m_opaque_sp->GetDescription().c_str());
+ return true;
+ }
+}
+
+void
+SBTypeFilter::Clear()
+{
+ if (CopyOnWrite_Impl())
+ m_opaque_sp->Clear();
+}
+
+uint32_t
+SBTypeFilter::GetNumberOfExpressionPaths()
+{
+ if (IsValid())
+ return m_opaque_sp->GetCount();
+ return 0;
+}
+
+const char*
+SBTypeFilter::GetExpressionPathAtIndex (uint32_t i)
+{
+ if (IsValid())
+ {
+ const char* item = m_opaque_sp->GetExpressionPathAtIndex(i);
+ if (item && *item == '.')
+ item++;
+ return item;
+ }
+ return NULL;
+}
+
+bool
+SBTypeFilter::ReplaceExpressionPathAtIndex (uint32_t i, const char* item)
+{
+ if (CopyOnWrite_Impl())
+ return m_opaque_sp->SetExpressionPathAtIndex(i, item);
+ else
+ return false;
+}
+
+void
+SBTypeFilter::AppendExpressionPath (const char* item)
+{
+ if (CopyOnWrite_Impl())
+ m_opaque_sp->AddExpressionPath(item);
+}
+
+lldb::SBTypeFilter &
+SBTypeFilter::operator = (const lldb::SBTypeFilter &rhs)
+{
+ if (this != &rhs)
+ {
+ m_opaque_sp = rhs.m_opaque_sp;
+ }
+ return *this;
+}
+
+bool
+SBTypeFilter::operator == (lldb::SBTypeFilter &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+
+ return m_opaque_sp == rhs.m_opaque_sp;
+}
+
+bool
+SBTypeFilter::IsEqualTo (lldb::SBTypeFilter &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+
+ if (GetNumberOfExpressionPaths() != rhs.GetNumberOfExpressionPaths())
+ return false;
+
+ for (uint32_t j = 0;
+ j < GetNumberOfExpressionPaths();
+ j++)
+ if ( strcmp(GetExpressionPathAtIndex(j),rhs.GetExpressionPathAtIndex(j)) != 0)
+ return false;
+
+ return GetOptions() == rhs.GetOptions();
+}
+
+bool
+SBTypeFilter::operator != (lldb::SBTypeFilter &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+
+ return m_opaque_sp != rhs.m_opaque_sp;
+}
+
+lldb::TypeFilterImplSP
+SBTypeFilter::GetSP ()
+{
+ return m_opaque_sp;
+}
+
+void
+SBTypeFilter::SetSP (const lldb::TypeFilterImplSP &typefilter_impl_sp)
+{
+ m_opaque_sp = typefilter_impl_sp;
+}
+
+SBTypeFilter::SBTypeFilter (const lldb::TypeFilterImplSP &typefilter_impl_sp) :
+m_opaque_sp(typefilter_impl_sp)
+{
+}
+
+bool
+SBTypeFilter::CopyOnWrite_Impl()
+{
+ if (!IsValid())
+ return false;
+ if (m_opaque_sp.unique())
+ return true;
+
+ TypeFilterImplSP new_sp(new TypeFilterImpl(GetOptions()));
+
+ for (uint32_t j = 0;
+ j < GetNumberOfExpressionPaths();
+ j++)
+ new_sp->AddExpressionPath(GetExpressionPathAtIndex(j));
+
+ SetSP(new_sp);
+
+ return true;
+}
diff --git a/source/API/SBTypeFormat.cpp b/source/API/SBTypeFormat.cpp
new file mode 100644
index 0000000..20df87b
--- /dev/null
+++ b/source/API/SBTypeFormat.cpp
@@ -0,0 +1,153 @@
+//===-- SBTypeFormat.cpp ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBTypeFormat.h"
+
+#include "lldb/API/SBStream.h"
+
+#include "lldb/Core/DataVisualization.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBTypeFormat::SBTypeFormat() :
+m_opaque_sp()
+{
+}
+
+SBTypeFormat::SBTypeFormat (lldb::Format format,
+ uint32_t options)
+: m_opaque_sp(TypeFormatImplSP(new TypeFormatImpl(format,options)))
+{
+}
+
+SBTypeFormat::SBTypeFormat (const lldb::SBTypeFormat &rhs) :
+m_opaque_sp(rhs.m_opaque_sp)
+{
+}
+
+SBTypeFormat::~SBTypeFormat ()
+{
+}
+
+bool
+SBTypeFormat::IsValid() const
+{
+ return m_opaque_sp.get() != NULL;
+}
+
+lldb::Format
+SBTypeFormat::GetFormat ()
+{
+ if (IsValid())
+ return m_opaque_sp->GetFormat();
+ return lldb::eFormatInvalid;
+}
+
+uint32_t
+SBTypeFormat::GetOptions()
+{
+ if (IsValid())
+ return m_opaque_sp->GetOptions();
+ return 0;
+}
+
+void
+SBTypeFormat::SetFormat (lldb::Format fmt)
+{
+ if (CopyOnWrite_Impl())
+ m_opaque_sp->SetFormat(fmt);
+}
+
+void
+SBTypeFormat::SetOptions (uint32_t value)
+{
+ if (CopyOnWrite_Impl())
+ m_opaque_sp->SetOptions(value);
+}
+
+bool
+SBTypeFormat::GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level)
+{
+ if (!IsValid())
+ return false;
+ else {
+ description.Printf("%s\n",
+ m_opaque_sp->GetDescription().c_str());
+ return true;
+ }
+}
+
+lldb::SBTypeFormat &
+SBTypeFormat::operator = (const lldb::SBTypeFormat &rhs)
+{
+ if (this != &rhs)
+ {
+ m_opaque_sp = rhs.m_opaque_sp;
+ }
+ return *this;
+}
+
+bool
+SBTypeFormat::operator == (lldb::SBTypeFormat &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+ return m_opaque_sp == rhs.m_opaque_sp;
+}
+
+bool
+SBTypeFormat::IsEqualTo (lldb::SBTypeFormat &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+
+ if (GetFormat() == rhs.GetFormat())
+ return GetOptions() == rhs.GetOptions();
+ else
+ return false;
+}
+
+bool
+SBTypeFormat::operator != (lldb::SBTypeFormat &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+ return m_opaque_sp != rhs.m_opaque_sp;
+}
+
+lldb::TypeFormatImplSP
+SBTypeFormat::GetSP ()
+{
+ return m_opaque_sp;
+}
+
+void
+SBTypeFormat::SetSP (const lldb::TypeFormatImplSP &typeformat_impl_sp)
+{
+ m_opaque_sp = typeformat_impl_sp;
+}
+
+SBTypeFormat::SBTypeFormat (const lldb::TypeFormatImplSP &typeformat_impl_sp) :
+ m_opaque_sp(typeformat_impl_sp)
+{
+}
+
+bool
+SBTypeFormat::CopyOnWrite_Impl()
+{
+ if (!IsValid())
+ return false;
+ if (m_opaque_sp.unique())
+ return true;
+
+ SetSP(TypeFormatImplSP(new TypeFormatImpl(GetFormat(),GetOptions())));
+ return true;
+}
diff --git a/source/API/SBTypeNameSpecifier.cpp b/source/API/SBTypeNameSpecifier.cpp
new file mode 100644
index 0000000..ef43e80
--- /dev/null
+++ b/source/API/SBTypeNameSpecifier.cpp
@@ -0,0 +1,127 @@
+//===-- SBTypeNameSpecifier.cpp ------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBTypeNameSpecifier.h"
+
+#include "lldb/API/SBStream.h"
+
+#include "lldb/Core/DataVisualization.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBTypeNameSpecifier::SBTypeNameSpecifier() :
+m_opaque_sp()
+{
+}
+
+SBTypeNameSpecifier::SBTypeNameSpecifier (const char* name,
+ bool is_regex) :
+m_opaque_sp(new TypeNameSpecifierImpl(name, is_regex))
+{
+ if (name == NULL || (*name) == 0)
+ m_opaque_sp.reset();
+}
+
+SBTypeNameSpecifier::SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs) :
+m_opaque_sp(rhs.m_opaque_sp)
+{}
+
+SBTypeNameSpecifier::~SBTypeNameSpecifier ()
+{
+}
+
+bool
+SBTypeNameSpecifier::IsValid() const
+{
+ return m_opaque_sp.get() != NULL;
+}
+
+const char*
+SBTypeNameSpecifier::GetName ()
+{
+ if (!IsValid())
+ return NULL;
+
+ return m_opaque_sp->GetName();
+}
+
+bool
+SBTypeNameSpecifier::IsRegex ()
+{
+ if (!IsValid())
+ return false;
+
+ return m_opaque_sp->IsRegex();
+}
+
+bool
+SBTypeNameSpecifier::GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level)
+{
+ if (!IsValid())
+ return false;
+ description.Printf("SBTypeNameSpecifier(%s,%s)", GetName(), IsRegex() ? "regex" : "plain");
+ return true;
+}
+
+lldb::SBTypeNameSpecifier &
+SBTypeNameSpecifier::operator = (const lldb::SBTypeNameSpecifier &rhs)
+{
+ if (this != &rhs)
+ {
+ m_opaque_sp = rhs.m_opaque_sp;
+ }
+ return *this;
+}
+
+bool
+SBTypeNameSpecifier::operator == (lldb::SBTypeNameSpecifier &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+ return m_opaque_sp == rhs.m_opaque_sp;
+}
+
+bool
+SBTypeNameSpecifier::IsEqualTo (lldb::SBTypeNameSpecifier &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+
+ if (IsRegex() != rhs.IsRegex())
+ return false;
+
+ return (strcmp(GetName(), rhs.GetName()) == 0);
+}
+
+bool
+SBTypeNameSpecifier::operator != (lldb::SBTypeNameSpecifier &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+ return m_opaque_sp != rhs.m_opaque_sp;
+}
+
+lldb::TypeNameSpecifierImplSP
+SBTypeNameSpecifier::GetSP ()
+{
+ return m_opaque_sp;
+}
+
+void
+SBTypeNameSpecifier::SetSP (const lldb::TypeNameSpecifierImplSP &type_namespec_sp)
+{
+ m_opaque_sp = type_namespec_sp;
+}
+
+SBTypeNameSpecifier::SBTypeNameSpecifier (const lldb::TypeNameSpecifierImplSP &type_namespec_sp) :
+m_opaque_sp(type_namespec_sp)
+{
+}
diff --git a/source/API/SBTypeSummary.cpp b/source/API/SBTypeSummary.cpp
new file mode 100644
index 0000000..5edff66
--- /dev/null
+++ b/source/API/SBTypeSummary.cpp
@@ -0,0 +1,298 @@
+//===-- SBTypeSummary.cpp -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBTypeSummary.h"
+
+#include "lldb/API/SBStream.h"
+
+#include "lldb/Core/DataVisualization.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBTypeSummary::SBTypeSummary() :
+m_opaque_sp()
+{
+}
+
+SBTypeSummary
+SBTypeSummary::CreateWithSummaryString (const char* data, uint32_t options)
+{
+ if (!data || data[0] == 0)
+ return SBTypeSummary();
+
+ return SBTypeSummary(TypeSummaryImplSP(new StringSummaryFormat(options, data)));
+}
+
+SBTypeSummary
+SBTypeSummary::CreateWithFunctionName (const char* data, uint32_t options)
+{
+ if (!data || data[0] == 0)
+ return SBTypeSummary();
+
+ return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, data)));
+}
+
+SBTypeSummary
+SBTypeSummary::CreateWithScriptCode (const char* data, uint32_t options)
+{
+ if (!data || data[0] == 0)
+ return SBTypeSummary();
+
+ return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, "", data)));
+}
+
+SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :
+m_opaque_sp(rhs.m_opaque_sp)
+{
+}
+
+SBTypeSummary::~SBTypeSummary ()
+{
+}
+
+bool
+SBTypeSummary::IsValid() const
+{
+ return m_opaque_sp.get() != NULL;
+}
+
+bool
+SBTypeSummary::IsFunctionCode()
+{
+ if (!IsValid())
+ return false;
+ if (m_opaque_sp->IsScripted())
+ {
+ ScriptSummaryFormat* script_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get();
+ const char* ftext = script_summary_ptr->GetPythonScript();
+ return (ftext && *ftext != 0);
+ }
+ return false;
+}
+
+bool
+SBTypeSummary::IsFunctionName()
+{
+ if (!IsValid())
+ return false;
+ if (m_opaque_sp->IsScripted())
+ {
+ ScriptSummaryFormat* script_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get();
+ const char* ftext = script_summary_ptr->GetPythonScript();
+ return (!ftext || *ftext == 0);
+ }
+ return false;
+}
+
+bool
+SBTypeSummary::IsSummaryString()
+{
+ if (!IsValid())
+ return false;
+
+ return !m_opaque_sp->IsScripted();
+}
+
+const char*
+SBTypeSummary::GetData ()
+{
+ if (!IsValid())
+ return NULL;
+ if (m_opaque_sp->IsScripted())
+ {
+ ScriptSummaryFormat* script_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get();
+ const char* fname = script_summary_ptr->GetFunctionName();
+ const char* ftext = script_summary_ptr->GetPythonScript();
+ if (ftext && *ftext)
+ return ftext;
+ return fname;
+ }
+ else
+ {
+ StringSummaryFormat* string_summary_ptr = (StringSummaryFormat*)m_opaque_sp.get();
+ return string_summary_ptr->GetSummaryString();
+ }
+}
+
+uint32_t
+SBTypeSummary::GetOptions ()
+{
+ if (!IsValid())
+ return lldb::eTypeOptionNone;
+ return m_opaque_sp->GetOptions();
+}
+
+void
+SBTypeSummary::SetOptions (uint32_t value)
+{
+ if (!CopyOnWrite_Impl())
+ return;
+ m_opaque_sp->SetOptions(value);
+}
+
+void
+SBTypeSummary::SetSummaryString (const char* data)
+{
+ if (!IsValid())
+ return;
+ if (m_opaque_sp->IsScripted())
+ ChangeSummaryType(false);
+ ((StringSummaryFormat*)m_opaque_sp.get())->SetSummaryString(data);
+}
+
+void
+SBTypeSummary::SetFunctionName (const char* data)
+{
+ if (!IsValid())
+ return;
+ if (!m_opaque_sp->IsScripted())
+ ChangeSummaryType(true);
+ ((ScriptSummaryFormat*)m_opaque_sp.get())->SetFunctionName(data);
+}
+
+void
+SBTypeSummary::SetFunctionCode (const char* data)
+{
+ if (!IsValid())
+ return;
+ if (!m_opaque_sp->IsScripted())
+ ChangeSummaryType(true);
+ ((ScriptSummaryFormat*)m_opaque_sp.get())->SetPythonScript(data);
+}
+
+bool
+SBTypeSummary::GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level)
+{
+ if (!CopyOnWrite_Impl())
+ return false;
+ else {
+ description.Printf("%s\n",
+ m_opaque_sp->GetDescription().c_str());
+ return true;
+ }
+}
+
+lldb::SBTypeSummary &
+SBTypeSummary::operator = (const lldb::SBTypeSummary &rhs)
+{
+ if (this != &rhs)
+ {
+ m_opaque_sp = rhs.m_opaque_sp;
+ }
+ return *this;
+}
+
+bool
+SBTypeSummary::operator == (lldb::SBTypeSummary &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+ return m_opaque_sp == rhs.m_opaque_sp;
+}
+
+bool
+SBTypeSummary::IsEqualTo (lldb::SBTypeSummary &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+
+ if (m_opaque_sp->IsScripted() != rhs.m_opaque_sp->IsScripted())
+ return false;
+
+ if (IsFunctionCode() != rhs.IsFunctionCode())
+ return false;
+
+ if (IsSummaryString() != rhs.IsSummaryString())
+ return false;
+
+ if (IsFunctionName() != rhs.IsFunctionName())
+ return false;
+
+ if ( strcmp(GetData(), rhs.GetData()) )
+ return false;
+
+ return GetOptions() == rhs.GetOptions();
+
+}
+
+bool
+SBTypeSummary::operator != (lldb::SBTypeSummary &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+ return m_opaque_sp != rhs.m_opaque_sp;
+}
+
+lldb::TypeSummaryImplSP
+SBTypeSummary::GetSP ()
+{
+ return m_opaque_sp;
+}
+
+void
+SBTypeSummary::SetSP (const lldb::TypeSummaryImplSP &typesummary_impl_sp)
+{
+ m_opaque_sp = typesummary_impl_sp;
+}
+
+SBTypeSummary::SBTypeSummary (const lldb::TypeSummaryImplSP &typesummary_impl_sp) :
+m_opaque_sp(typesummary_impl_sp)
+{
+}
+
+bool
+SBTypeSummary::CopyOnWrite_Impl()
+{
+ if (!IsValid())
+ return false;
+ if (m_opaque_sp.unique())
+ return true;
+
+ TypeSummaryImplSP new_sp;
+
+ if (m_opaque_sp->IsScripted())
+ {
+ ScriptSummaryFormat* current_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get();
+ new_sp = TypeSummaryImplSP(new ScriptSummaryFormat(GetOptions(),
+ current_summary_ptr->GetFunctionName(),
+ current_summary_ptr->GetPythonScript()));
+ }
+ else {
+ StringSummaryFormat* current_summary_ptr = (StringSummaryFormat*)m_opaque_sp.get();
+ new_sp = TypeSummaryImplSP(new StringSummaryFormat(GetOptions(),
+ current_summary_ptr->GetSummaryString()));
+ }
+
+ SetSP(new_sp);
+
+ return true;
+}
+
+bool
+SBTypeSummary::ChangeSummaryType (bool want_script)
+{
+ if (!IsValid())
+ return false;
+
+ if (want_script == m_opaque_sp->IsScripted())
+ return CopyOnWrite_Impl();
+
+ TypeSummaryImplSP new_sp;
+
+ if (want_script)
+ new_sp = TypeSummaryImplSP(new ScriptSummaryFormat(GetOptions(), "", ""));
+ else
+ new_sp = TypeSummaryImplSP(new StringSummaryFormat(GetOptions(), ""));
+
+ SetSP(new_sp);
+
+ return true;
+}
diff --git a/source/API/SBTypeSynthetic.cpp b/source/API/SBTypeSynthetic.cpp
new file mode 100644
index 0000000..66e2d8b
--- /dev/null
+++ b/source/API/SBTypeSynthetic.cpp
@@ -0,0 +1,203 @@
+//===-- SBTypeSynthetic.cpp -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBTypeSynthetic.h"
+
+#include "lldb/API/SBStream.h"
+
+#include "lldb/Core/DataVisualization.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBTypeSynthetic::SBTypeSynthetic() :
+m_opaque_sp()
+{
+}
+
+SBTypeSynthetic
+SBTypeSynthetic::CreateWithClassName (const char* data, uint32_t options)
+{
+ if (!data || data[0] == 0)
+ return SBTypeSynthetic();
+ return SBTypeSynthetic(TypeSyntheticImplSP(new TypeSyntheticImpl(options, data, "")));
+}
+
+SBTypeSynthetic
+SBTypeSynthetic::CreateWithScriptCode (const char* data, uint32_t options)
+{
+ if (!data || data[0] == 0)
+ return SBTypeSynthetic();
+ return SBTypeSynthetic(TypeSyntheticImplSP(new TypeSyntheticImpl(options, "", data)));
+}
+
+SBTypeSynthetic::SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs) :
+m_opaque_sp(rhs.m_opaque_sp)
+{
+}
+
+SBTypeSynthetic::~SBTypeSynthetic ()
+{
+}
+
+bool
+SBTypeSynthetic::IsValid() const
+{
+ return m_opaque_sp.get() != NULL;
+}
+
+bool
+SBTypeSynthetic::IsClassCode()
+{
+ if (!IsValid())
+ return false;
+ const char* code = m_opaque_sp->GetPythonCode();
+ return (code && *code);
+}
+
+bool
+SBTypeSynthetic::IsClassName()
+{
+ if (!IsValid())
+ return false;
+ return !IsClassCode();
+}
+
+const char*
+SBTypeSynthetic::GetData ()
+{
+ if (!IsValid())
+ return NULL;
+ if (IsClassCode())
+ return m_opaque_sp->GetPythonCode();
+ else
+ return m_opaque_sp->GetPythonClassName();
+}
+
+void
+SBTypeSynthetic::SetClassName (const char* data)
+{
+ if (IsValid() && data && *data)
+ m_opaque_sp->SetPythonClassName(data);
+}
+
+void
+SBTypeSynthetic::SetClassCode (const char* data)
+{
+ if (IsValid() && data && *data)
+ m_opaque_sp->SetPythonCode(data);
+}
+
+uint32_t
+SBTypeSynthetic::GetOptions ()
+{
+ if (!IsValid())
+ return lldb::eTypeOptionNone;
+ return m_opaque_sp->GetOptions();
+}
+
+void
+SBTypeSynthetic::SetOptions (uint32_t value)
+{
+ if (!CopyOnWrite_Impl())
+ return;
+ m_opaque_sp->SetOptions(value);
+}
+
+bool
+SBTypeSynthetic::GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level)
+{
+ if (!CopyOnWrite_Impl())
+ return false;
+ else {
+ description.Printf("%s\n",
+ m_opaque_sp->GetDescription().c_str());
+ return true;
+ }
+}
+
+lldb::SBTypeSynthetic &
+SBTypeSynthetic::operator = (const lldb::SBTypeSynthetic &rhs)
+{
+ if (this != &rhs)
+ {
+ m_opaque_sp = rhs.m_opaque_sp;
+ }
+ return *this;
+}
+
+bool
+SBTypeSynthetic::operator == (lldb::SBTypeSynthetic &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+ return m_opaque_sp == rhs.m_opaque_sp;
+}
+
+bool
+SBTypeSynthetic::IsEqualTo (lldb::SBTypeSynthetic &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+
+ if (m_opaque_sp->IsScripted() != rhs.m_opaque_sp->IsScripted())
+ return false;
+
+ if (IsClassCode() != rhs.IsClassCode())
+ return false;
+
+ if ( strcmp(GetData(), rhs.GetData()) )
+ return false;
+
+ return GetOptions() == rhs.GetOptions();
+
+}
+
+bool
+SBTypeSynthetic::operator != (lldb::SBTypeSynthetic &rhs)
+{
+ if (IsValid() == false)
+ return !rhs.IsValid();
+ return m_opaque_sp != rhs.m_opaque_sp;
+}
+
+lldb::TypeSyntheticImplSP
+SBTypeSynthetic::GetSP ()
+{
+ return m_opaque_sp;
+}
+
+void
+SBTypeSynthetic::SetSP (const lldb::TypeSyntheticImplSP &TypeSynthetic_impl_sp)
+{
+ m_opaque_sp = TypeSynthetic_impl_sp;
+}
+
+SBTypeSynthetic::SBTypeSynthetic (const lldb::TypeSyntheticImplSP &TypeSynthetic_impl_sp) :
+m_opaque_sp(TypeSynthetic_impl_sp)
+{
+}
+
+bool
+SBTypeSynthetic::CopyOnWrite_Impl()
+{
+ if (!IsValid())
+ return false;
+ if (m_opaque_sp.unique())
+ return true;
+
+ TypeSyntheticImplSP new_sp(new TypeSyntheticImpl(m_opaque_sp->GetOptions(),
+ m_opaque_sp->GetPythonClassName(),
+ m_opaque_sp->GetPythonCode()));
+
+ SetSP(new_sp);
+
+ return true;
+}