[lldb] Small improvements in ValueObjectPrinter::PrintDecl (NFC)
Remove unused argument, simply code and reformat.
This commit is contained in:
@@ -151,11 +151,11 @@ const char *ValueObjectPrinter::GetDescriptionForDisplay() {
|
||||
return str;
|
||||
}
|
||||
|
||||
const char *ValueObjectPrinter::GetRootNameForDisplay(const char *if_fail) {
|
||||
const char *ValueObjectPrinter::GetRootNameForDisplay() {
|
||||
const char *root_valobj_name = m_options.m_root_valobj_name.empty()
|
||||
? m_valobj->GetName().AsCString()
|
||||
: m_options.m_root_valobj_name.c_str();
|
||||
return root_valobj_name ? root_valobj_name : if_fail;
|
||||
return root_valobj_name ? root_valobj_name : "";
|
||||
}
|
||||
|
||||
bool ValueObjectPrinter::ShouldPrintValueObject() {
|
||||
@@ -239,17 +239,14 @@ void ValueObjectPrinter::PrintDecl() {
|
||||
// type if there is one to print
|
||||
ConstString type_name;
|
||||
if (m_compiler_type.IsValid()) {
|
||||
if (m_options.m_use_type_display_name)
|
||||
type_name = m_valobj->GetDisplayTypeName();
|
||||
else
|
||||
type_name = m_valobj->GetQualifiedTypeName();
|
||||
type_name = m_options.m_use_type_display_name
|
||||
? m_valobj->GetDisplayTypeName()
|
||||
: m_valobj->GetQualifiedTypeName();
|
||||
} else {
|
||||
// only show an invalid type name if the user explicitly triggered
|
||||
// show_type
|
||||
if (m_options.m_show_types)
|
||||
type_name = ConstString("<invalid type>");
|
||||
else
|
||||
type_name.Clear();
|
||||
}
|
||||
|
||||
if (type_name) {
|
||||
@@ -260,7 +257,7 @@ void ValueObjectPrinter::PrintDecl() {
|
||||
type_name_str.erase(iter, 2);
|
||||
}
|
||||
}
|
||||
typeName.Printf("%s", type_name_str.c_str());
|
||||
typeName << type_name_str.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,10 +266,8 @@ void ValueObjectPrinter::PrintDecl() {
|
||||
if (!m_options.m_hide_name) {
|
||||
if (m_options.m_flat_output)
|
||||
m_valobj->GetExpressionPath(varName);
|
||||
else {
|
||||
const char *name_cstr = GetRootNameForDisplay("");
|
||||
varName.Printf("%s", name_cstr);
|
||||
}
|
||||
else
|
||||
varName << GetRootNameForDisplay();
|
||||
}
|
||||
|
||||
bool decl_printed = false;
|
||||
@@ -448,9 +443,9 @@ bool ValueObjectPrinter::PrintObjectDescriptionIfNeeded(bool value_printed,
|
||||
// If the description already ends with a \n don't add another one.
|
||||
size_t object_end = strlen(object_desc) - 1;
|
||||
if (object_desc[object_end] == '\n')
|
||||
m_stream->Printf("%s", object_desc);
|
||||
m_stream->Printf("%s", object_desc);
|
||||
else
|
||||
m_stream->Printf("%s\n", object_desc);
|
||||
m_stream->Printf("%s\n", object_desc);
|
||||
return true;
|
||||
} else if (!value_printed && !summary_printed)
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user