[Lldb-commits] [lldb] r207046 - Allow summary formatters to take ValueObjects into account when deciding whether values/children should be printed and if child names should be shown
Enrico Granata
egranata at apple.com
Wed Apr 23 16:16:25 PDT 2014
Author: enrico
Date: Wed Apr 23 18:16:25 2014
New Revision: 207046
URL: http://llvm.org/viewvc/llvm-project?rev=207046&view=rev
Log:
Allow summary formatters to take ValueObjects into account when deciding whether values/children should be printed and if child names should be shown
This decision has always been statically-bound to the individual formatter. With this patch, the idea is that this decision could potentially be dynamic depending on the ValueObject itself
Modified:
lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
lldb/trunk/source/DataFormatters/FormatManager.cpp
lldb/trunk/source/DataFormatters/TypeSummary.cpp
lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
Modified: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSummary.h?rev=207046&r1=207045&r2=207046&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeSummary.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSummary.h Wed Apr 23 18:16:25 2014
@@ -225,14 +225,14 @@ namespace lldb_private {
return m_flags.GetSkipReferences();
}
- bool
- DoesPrintChildren () const
+ virtual bool
+ DoesPrintChildren (ValueObject* valobj) const
{
return !m_flags.GetDontShowChildren();
}
- bool
- DoesPrintValue () const
+ virtual bool
+ DoesPrintValue (ValueObject* valobj) const
{
return !m_flags.GetDontShowValue();
}
@@ -243,8 +243,8 @@ namespace lldb_private {
return m_flags.GetShowMembersOneLiner();
}
- bool
- HideNames () const
+ virtual bool
+ HideNames (ValueObject* valobj) const
{
return m_flags.GetHideItemNames();
}
@@ -267,13 +267,13 @@ namespace lldb_private {
m_flags.SetSkipReferences(value);
}
- void
+ virtual void
SetDoesPrintChildren (bool value)
{
m_flags.SetDontShowChildren(!value);
}
- void
+ virtual void
SetDoesPrintValue (bool value)
{
m_flags.SetDontShowValue(!value);
@@ -285,7 +285,7 @@ namespace lldb_private {
m_flags.SetShowMembersOneLiner(value);
}
- void
+ virtual void
SetHideNames (bool value)
{
m_flags.SetHideItemNames(value);
Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=207046&r1=207045&r2=207046&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Wed Apr 23 18:16:25 2014
@@ -533,7 +533,7 @@ FormatManager::ShouldPrintAsOneLiner (Va
if (child_sp->GetSummaryFormat())
{
// and it wants children, then bail out
- if (child_sp->GetSummaryFormat()->DoesPrintChildren())
+ if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
return false;
}
Modified: lldb/trunk/source/DataFormatters/TypeSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeSummary.cpp?rev=207046&r1=207045&r2=207046&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeSummary.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeSummary.cpp Wed Apr 23 18:16:25 2014
@@ -69,7 +69,7 @@ StringSummaryFormat::FormatObject (Value
if (IsOneLiner())
{
ValueObjectPrinter printer(valobj,&s,DumpValueObjectOptions());
- printer.PrintChildrenOneLiner(HideNames());
+ printer.PrintChildrenOneLiner(HideNames(valobj));
retval.assign(s.GetData());
return true;
}
@@ -95,12 +95,12 @@ StringSummaryFormat::GetDescription ()
sstr.Printf ("`%s`%s%s%s%s%s%s%s", m_format.c_str(),
Cascades() ? "" : " (not cascading)",
- !DoesPrintChildren() ? "" : " (show children)",
- !DoesPrintValue() ? " (hide value)" : "",
+ !DoesPrintChildren(nullptr) ? "" : " (show children)",
+ !DoesPrintValue(nullptr) ? " (hide value)" : "",
IsOneLiner() ? " (one-line printout)" : "",
SkipsPointers() ? " (skip pointers)" : "",
SkipsReferences() ? " (skip references)" : "",
- HideNames() ? " (hide member names)" : "");
+ HideNames(nullptr) ? " (hide member names)" : "");
return sstr.GetString();
}
@@ -132,12 +132,12 @@ CXXFunctionSummaryFormat::GetDescription
sstr.Printf ("`%s (%p) `%s%s%s%s%s%s%s", m_description.c_str(),
static_cast<void*>(&m_impl),
Cascades() ? "" : " (not cascading)",
- !DoesPrintChildren() ? "" : " (show children)",
- !DoesPrintValue() ? " (hide value)" : "",
+ !DoesPrintChildren(nullptr) ? "" : " (show children)",
+ !DoesPrintValue(nullptr) ? " (hide value)" : "",
IsOneLiner() ? " (one-line printout)" : "",
SkipsPointers() ? " (skip pointers)" : "",
SkipsReferences() ? " (skip references)" : "",
- HideNames() ? " (hide member names)" : "");
+ HideNames(nullptr) ? " (hide member names)" : "");
return sstr.GetString();
}
@@ -199,12 +199,12 @@ ScriptSummaryFormat::GetDescription ()
{
StreamString sstr;
sstr.Printf ("%s%s%s%s%s%s%s\n%s", Cascades() ? "" : " (not cascading)",
- !DoesPrintChildren() ? "" : " (show children)",
- !DoesPrintValue() ? " (hide value)" : "",
+ !DoesPrintChildren(nullptr) ? "" : " (show children)",
+ !DoesPrintValue(nullptr) ? " (hide value)" : "",
IsOneLiner() ? " (one-line printout)" : "",
SkipsPointers() ? " (skip pointers)" : "",
SkipsReferences() ? " (skip references)" : "",
- HideNames() ? " (hide member names)" : "",
+ HideNames(nullptr) ? " (hide member names)" : "",
m_python_script.c_str());
return sstr.GetString();
Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=207046&r1=207045&r2=207046&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Wed Apr 23 18:16:25 2014
@@ -341,7 +341,7 @@ ValueObjectPrinter::PrintValueAndSummary
// the value if this thing is nil
// (but show the value if the user passes a format explicitly)
TypeSummaryImpl* entry = GetSummaryFormatter();
- if (!IsNil() && !m_value.empty() && (entry == NULL || (entry->DoesPrintValue() || options.m_format != eFormatDefault) || m_summary.empty()) && !options.m_hide_value)
+ if (!IsNil() && !m_value.empty() && (entry == NULL || (entry->DoesPrintValue(m_valobj) || options.m_format != eFormatDefault) || m_summary.empty()) && !options.m_hide_value)
{
m_stream->Printf(" %s", m_value.c_str());
value_printed = true;
@@ -426,7 +426,7 @@ ValueObjectPrinter::ShouldPrintChildren
TypeSummaryImpl* entry = GetSummaryFormatter();
- return (!entry || entry->DoesPrintChildren() || m_summary.empty());
+ return (!entry || entry->DoesPrintChildren(m_valobj) || m_summary.empty());
}
return false;
}
More information about the lldb-commits
mailing list