diff options
author | Enrico Granata <egranata@apple.com> | 2015-09-01 00:19:35 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-09-01 00:19:35 +0000 |
commit | ad91c7cee227d3271cff641a6ba583d1d9c9e736 (patch) | |
tree | 95b2f4ac1a4d4770bd474f5d348fd593e3b16eed /lldb/source/Core/FormatEntity.cpp | |
parent | b56cb9437fe9c032600a1c078223c09cedf40d56 (diff) | |
download | bcm5719-llvm-ad91c7cee227d3271cff641a6ba583d1d9c9e736.tar.gz bcm5719-llvm-ad91c7cee227d3271cff641a6ba583d1d9c9e736.zip |
Make FormatEntity be a little bit smarter when printing function arguments
llvm-svn: 246512
Diffstat (limited to 'lldb/source/Core/FormatEntity.cpp')
-rw-r--r-- | lldb/source/Core/FormatEntity.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 0f8599ae404..a53b46a5301 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -20,6 +20,7 @@ #include "lldb/Core/ValueObjectVariable.h" #include "lldb/DataFormatters/DataVisualization.h" #include "lldb/DataFormatters/FormatManager.h" +#include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Expression/ClangExpressionVariable.h" #include "lldb/Host/FileSpec.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -1785,20 +1786,34 @@ FormatEntity::Format (const Entry &entry, VariableSP var_sp (args.GetVariableAtIndex (arg_idx)); ValueObjectSP var_value_sp (ValueObjectVariable::Create (exe_scope, var_sp)); + StreamString ss; const char *var_representation = nullptr; const char *var_name = var_value_sp->GetName().GetCString(); - if (var_value_sp->GetCompilerType().IsAggregateType() && - DataVisualization::ShouldPrintAsOneLiner(*var_value_sp.get())) + if (var_value_sp->GetCompilerType().IsValid()) { - static StringSummaryFormat format(TypeSummaryImpl::Flags() - .SetHideItemNames(false) - .SetShowMembersOneLiner(true), - ""); - format.FormatObject(var_value_sp.get(), buffer, TypeSummaryOptions()); - var_representation = buffer.c_str(); + if (var_value_sp && exe_scope->CalculateTarget()) + var_value_sp = var_value_sp->GetQualifiedRepresentationIfAvailable(exe_scope->CalculateTarget()->TargetProperties::GetPreferDynamicValue(), + exe_scope->CalculateTarget()->TargetProperties::GetEnableSyntheticValue()); + if (var_value_sp->GetCompilerType().IsAggregateType() && + DataVisualization::ShouldPrintAsOneLiner(*var_value_sp.get())) + { + static StringSummaryFormat format(TypeSummaryImpl::Flags() + .SetHideItemNames(false) + .SetShowMembersOneLiner(true), + ""); + format.FormatObject(var_value_sp.get(), buffer, TypeSummaryOptions()); + var_representation = buffer.c_str(); + } + else + var_value_sp->DumpPrintableRepresentation(ss, + ValueObject::ValueObjectRepresentationStyle::eValueObjectRepresentationStyleSummary, + eFormatDefault, + ValueObject::PrintableRepresentationSpecialCases::ePrintableRepresentationSpecialCasesAllow, + false); } - else - var_representation = var_value_sp->GetValueAsCString(); + + if (ss.GetData() && ss.GetSize()) + var_representation = ss.GetData(); if (arg_idx > 0) s.PutCString (", "); if (var_value_sp->GetError().Success()) |