diff options
author | Enrico Granata <egranata@apple.com> | 2014-04-23 23:16:25 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2014-04-23 23:16:25 +0000 |
commit | 8a068e6c430755ef3d8e92dcf4264af50529ce3e (patch) | |
tree | b23aaf2b8f2748454823e140fbca388a64260ee1 /lldb/source/DataFormatters | |
parent | a10e240377c770b1b511182d321b0de5c731d89d (diff) | |
download | bcm5719-llvm-8a068e6c430755ef3d8e92dcf4264af50529ce3e.tar.gz bcm5719-llvm-8a068e6c430755ef3d8e92dcf4264af50529ce3e.zip |
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
llvm-svn: 207046
Diffstat (limited to 'lldb/source/DataFormatters')
-rw-r--r-- | lldb/source/DataFormatters/FormatManager.cpp | 2 | ||||
-rw-r--r-- | lldb/source/DataFormatters/TypeSummary.cpp | 20 | ||||
-rw-r--r-- | lldb/source/DataFormatters/ValueObjectPrinter.cpp | 4 |
3 files changed, 13 insertions, 13 deletions
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index 0ccb826bd82..9fe89b187bf 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -533,7 +533,7 @@ FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj) 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; } diff --git a/lldb/source/DataFormatters/TypeSummary.cpp b/lldb/source/DataFormatters/TypeSummary.cpp index 628c385b92d..e5d80174c3c 100644 --- a/lldb/source/DataFormatters/TypeSummary.cpp +++ b/lldb/source/DataFormatters/TypeSummary.cpp @@ -69,7 +69,7 @@ StringSummaryFormat::FormatObject (ValueObject *valobj, 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(); diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp index 944d6d2d13a..565d4d419da 100644 --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -341,7 +341,7 @@ ValueObjectPrinter::PrintValueAndSummaryIfNeeded (bool& value_printed, // 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 (bool is_failed_description, TypeSummaryImpl* entry = GetSummaryFormatter(); - return (!entry || entry->DoesPrintChildren() || m_summary.empty()); + return (!entry || entry->DoesPrintChildren(m_valobj) || m_summary.empty()); } return false; } |