diff options
Diffstat (limited to 'lldb/source/DataFormatters/ValueObjectPrinter.cpp')
-rw-r--r-- | lldb/source/DataFormatters/ValueObjectPrinter.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp index 5c7f48b600b..f8a9151b4a6 100644 --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -282,17 +282,15 @@ ValueObjectPrinter::GetValueSummaryError (std::string& value, std::string& summary, std::string& error) { - if (options.m_format != eFormatDefault && options.m_format != m_valobj->GetFormat()) + lldb::Format original_format; + bool custom_format = options.m_format != eFormatDefault && options.m_format != m_valobj->GetFormat(); + if (custom_format) { - m_valobj->GetValueAsCString(options.m_format, - value); - } - else - { - const char* val_cstr = m_valobj->GetValueAsCString(); - if (val_cstr) - value.assign(val_cstr); + original_format = m_valobj->GetFormat(); + m_valobj->SetFormat(options.m_format); } + const char* val_cstr = m_valobj->GetValueAsCString(); + value.assign(val_cstr ? val_cstr : ""); const char* err_cstr = m_valobj->GetError().AsCString(); if (err_cstr) error.assign(err_cstr); @@ -314,6 +312,8 @@ ValueObjectPrinter::GetValueSummaryError (std::string& value, } } } + if (custom_format) + m_valobj->SetFormat(original_format); } bool |