Our commands that end up displaying a ValueObject as part of their workflow use OptionGroupValueObjectDisplay as their currency for deciding the final representation
ValueObjects themselves use DumpValueObjectOptions as the currency for the same purpose
The code to convert between these two units was replicated (to varying degrees of correctness) in several spots in the code
This checkin provides one and only one (and hopefully correct :-) entry point for this conversion
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178044 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/source/Interpreter/OptionGroupValueObjectDisplay.cpp
index c6d2e1e..22a7f37 100644
--- a/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ b/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -146,3 +146,36 @@
use_dynamic = lldb::eNoDynamicValues;
}
}
+
+ValueObject::DumpValueObjectOptions
+OptionGroupValueObjectDisplay::GetAsDumpOptions (bool objc_is_compact,
+ lldb::Format format,
+ lldb::TypeSummaryImplSP summary_sp)
+{
+ ValueObject::DumpValueObjectOptions options;
+ options.SetMaximumPointerDepth(ptr_depth);
+ if (use_objc)
+ options.SetShowSummary(false);
+ else
+ options.SetOmitSummaryDepth(no_summary_depth);
+ options.SetMaximumDepth(max_depth)
+ .SetShowTypes(show_types)
+ .SetShowLocation(show_location)
+ .SetUseObjectiveC(use_objc)
+ .SetUseDynamicType(use_dynamic)
+ .SetUseSyntheticValue(use_synth)
+ .SetFlatOutput(flat_output)
+ .SetIgnoreCap(ignore_cap)
+ .SetFormat(format)
+ .SetSummary(summary_sp);
+
+ if (objc_is_compact)
+ options.SetHideRootType(use_objc)
+ .SetHideName(use_objc)
+ .SetHideValue(use_objc);
+
+ if (be_raw)
+ options.SetRawDisplay(true);
+
+ return options;
+}