diff options
author | Enrico Granata <egranata@apple.com> | 2015-10-07 02:36:35 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-10-07 02:36:35 +0000 |
commit | 73e8c4d09cf5a0497bc34b4f7c7206c59ae35669 (patch) | |
tree | 1be7e60f80ce16a43192d6405845c565ef2fbe37 /lldb/source | |
parent | d54f7fb8eb3c0817d17c89640a8e3bcf0622c952 (diff) | |
download | bcm5719-llvm-73e8c4d09cf5a0497bc34b4f7c7206c59ae35669.tar.gz bcm5719-llvm-73e8c4d09cf5a0497bc34b4f7c7206c59ae35669.zip |
Route the preferred-display-language mechanism to the ValueObjectPrinter and actually fill in a few gaps for dynamic and synthetic values to be able to adopt this in useful ways
llvm-svn: 249507
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 7 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectConstResult.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectDynamicValue.cpp | 21 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectSyntheticFilter.cpp | 22 | ||||
-rw-r--r-- | lldb/source/DataFormatters/ValueObjectPrinter.cpp | 5 |
7 files changed, 59 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 96dd90e7ecc..980d11cb1cf 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -335,6 +335,7 @@ CommandObjectExpression::EvaluateExpression result_valobj_sp->SetFormat (format); DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(m_command_options.m_verbosity,format)); + options.SetVariableFormatDisplayLanguage(result_valobj_sp->GetPreferredDisplayLanguage()); result_valobj_sp->Dump(*output_stream,options); diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index f6382433e4c..5f5585aa6d3 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -500,6 +500,7 @@ protected: } options.SetFormat(format); + options.SetVariableFormatDisplayLanguage(valobj_sp->GetPreferredDisplayLanguage()); Stream &output_stream = result.GetOutputStream(); options.SetRootValueObjectName(valobj_sp->GetParent() ? name_cstr : NULL); @@ -586,6 +587,7 @@ protected: } options.SetFormat(format); + options.SetVariableFormatDisplayLanguage(valobj_sp->GetPreferredDisplayLanguage()); options.SetRootValueObjectName(name_cstr); valobj_sp->Dump(result.GetOutputStream(),options); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index a784f49b7ff..708526d4469 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -4259,6 +4259,13 @@ ValueObject::SetPreferredDisplayLanguage (lldb::LanguageType lt) m_preferred_display_language = lt; } +void +ValueObject::SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType lt) +{ + if (m_preferred_display_language == lldb::eLanguageTypeUnknown) + SetPreferredDisplayLanguage(lt); +} + bool ValueObject::CanProvideValue () { diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp index 11925256708..6154829b240 100644 --- a/lldb/source/Core/ValueObjectConstResult.cpp +++ b/lldb/source/Core/ValueObjectConstResult.cpp @@ -374,5 +374,7 @@ ValueObjectConstResult::Cast (const CompilerType &compiler_type) lldb::LanguageType ValueObjectConstResult::GetPreferredDisplayLanguage () { - return lldb::eLanguageTypeUnknown; + if (m_preferred_display_language != lldb::eLanguageTypeUnknown) + return m_preferred_display_language; + return GetCompilerTypeImpl().GetMinimumLanguage(); } diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index e801bd71434..329d3c149e8 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -391,6 +391,27 @@ ValueObjectDynamicValue::SetData (DataExtractor &data, Error &error) return ret_val; } +void +ValueObjectDynamicValue::SetPreferredDisplayLanguage (lldb::LanguageType lang) +{ + this->ValueObject::SetPreferredDisplayLanguage(lang); + if (m_parent) + m_parent->SetPreferredDisplayLanguage(lang); +} + +lldb::LanguageType +ValueObjectDynamicValue::GetPreferredDisplayLanguage () +{ + if (m_preferred_display_language == lldb::eLanguageTypeUnknown) + { + if (m_parent) + return m_parent->GetPreferredDisplayLanguage(); + return lldb::eLanguageTypeUnknown; + } + else + return m_preferred_display_language; +} + bool ValueObjectDynamicValue::GetDeclaration (Declaration &decl) { diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index 899c064e2f0..e82862af1df 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -223,6 +223,7 @@ ValueObjectSynthetic::GetChildAtIndex (size_t idx, bool can_create) if (!synth_guy) return synth_guy; m_children_byindex.SetValueForKey(idx, synth_guy.get()); + synth_guy->SetPreferredDisplayLanguageIfNeeded(GetPreferredDisplayLanguage()); return synth_guy; } else @@ -315,6 +316,27 @@ ValueObjectSynthetic::SetFormat (lldb::Format format) this->ClearUserVisibleData(eClearUserVisibleDataItemsAll); } +void +ValueObjectSynthetic::SetPreferredDisplayLanguage (lldb::LanguageType lang) +{ + this->ValueObject::SetPreferredDisplayLanguage(lang); + if (m_parent) + m_parent->SetPreferredDisplayLanguage(lang); +} + +lldb::LanguageType +ValueObjectSynthetic::GetPreferredDisplayLanguage () +{ + if (m_preferred_display_language == lldb::eLanguageTypeUnknown) + { + if (m_parent) + return m_parent->GetPreferredDisplayLanguage(); + return lldb::eLanguageTypeUnknown; + } + else + return m_preferred_display_language; +} + bool ValueObjectSynthetic::GetDeclaration (Declaration &decl) { diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp index 2d122dba4cd..63fb6cc46d3 100644 --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -26,6 +26,7 @@ DumpValueObjectOptions() { m_use_dynamic = valobj.GetDynamicValueType(); m_use_synthetic = valobj.IsSynthetic(); + m_varformat_language = valobj.GetPreferredDisplayLanguage(); } ValueObjectPrinter::ValueObjectPrinter (ValueObject* valobj, @@ -354,10 +355,10 @@ ValueObjectPrinter::GetValueSummaryError (std::string& value, { TypeSummaryImpl* entry = GetSummaryFormatter(); if (entry) - m_valobj->GetSummaryAsCString(entry, summary); + m_valobj->GetSummaryAsCString(entry, summary, options.m_varformat_language); else { - const char* sum_cstr = m_valobj->GetSummaryAsCString(); + const char* sum_cstr = m_valobj->GetSummaryAsCString(options.m_varformat_language); if (sum_cstr) summary.assign(sum_cstr); } |