If a user specifies a format option to frame variable or expression, that format should prevail over whatever format(s) a summary specifies

(see test case for an example)

llvm-svn: 199857
This commit is contained in:
Enrico Granata
2014-01-23 01:21:18 +00:00
parent 76747120ca
commit 90890bba04
5 changed files with 120 additions and 13 deletions

View File

@@ -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