1 //===-- DumpValueObjectOptions.cpp ----------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "lldb/DataFormatters/DumpValueObjectOptions.h"
11 #include "lldb/Core/ValueObject.h"
14 using namespace lldb_private
;
16 DumpValueObjectOptions::DumpValueObjectOptions()
17 : m_summary_sp(), m_root_valobj_name(),
18 m_max_ptr_depth(PointerDepth
{PointerDepth::Mode::Default
, 0}),
19 m_decl_printing_helper(), m_child_printing_decider(),
20 m_pointer_as_array(), m_use_synthetic(true),
21 m_scope_already_checked(false), m_flat_output(false), m_ignore_cap(false),
22 m_show_types(false), m_show_location(false), m_use_objc(false),
23 m_hide_root_type(false), m_hide_root_name(false), m_hide_name(false),
24 m_hide_value(false), m_run_validator(false),
25 m_use_type_display_name(true), m_allow_oneliner_mode(true),
26 m_hide_pointer_value(false), m_reveal_empty_aggregates(true) {}
28 DumpValueObjectOptions::DumpValueObjectOptions(ValueObject
&valobj
)
29 : DumpValueObjectOptions() {
30 m_use_dynamic
= valobj
.GetDynamicValueType();
31 m_use_synthetic
= valobj
.IsSynthetic();
32 m_varformat_language
= valobj
.GetPreferredDisplayLanguage();
35 DumpValueObjectOptions
&
36 DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth
) {
37 m_max_ptr_depth
= depth
;
41 DumpValueObjectOptions
&
42 DumpValueObjectOptions::SetMaximumDepth(uint32_t depth
, bool is_default
) {
44 m_max_depth_is_default
= is_default
;
48 DumpValueObjectOptions
&
49 DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper
) {
50 m_decl_printing_helper
= helper
;
54 DumpValueObjectOptions
&
55 DumpValueObjectOptions::SetChildPrintingDecider(ChildPrintingDecider decider
) {
56 m_child_printing_decider
= decider
;
60 DumpValueObjectOptions
&DumpValueObjectOptions::SetShowTypes(bool show
) {
65 DumpValueObjectOptions
&DumpValueObjectOptions::SetShowLocation(bool show
) {
66 m_show_location
= show
;
70 DumpValueObjectOptions
&DumpValueObjectOptions::SetUseObjectiveC(bool use
) {
75 DumpValueObjectOptions
&DumpValueObjectOptions::SetShowSummary(bool show
) {
77 SetOmitSummaryDepth(UINT32_MAX
);
79 SetOmitSummaryDepth(0);
83 DumpValueObjectOptions
&
84 DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn
) {
89 DumpValueObjectOptions
&
90 DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic
) {
91 m_use_synthetic
= use_synthetic
;
95 DumpValueObjectOptions
&DumpValueObjectOptions::SetScopeChecked(bool check
) {
96 m_scope_already_checked
= check
;
100 DumpValueObjectOptions
&DumpValueObjectOptions::SetFlatOutput(bool flat
) {
101 m_flat_output
= flat
;
105 DumpValueObjectOptions
&
106 DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth
) {
107 m_omit_summary_depth
= depth
;
111 DumpValueObjectOptions
&DumpValueObjectOptions::SetIgnoreCap(bool ignore
) {
112 m_ignore_cap
= ignore
;
116 DumpValueObjectOptions
&DumpValueObjectOptions::SetRawDisplay() {
117 SetUseSyntheticValue(false);
118 SetOmitSummaryDepth(UINT32_MAX
);
122 SetUseTypeDisplayName(false);
123 SetAllowOnelinerMode(false);
127 DumpValueObjectOptions
&DumpValueObjectOptions::SetFormat(lldb::Format format
) {
132 DumpValueObjectOptions
&
133 DumpValueObjectOptions::SetSummary(lldb::TypeSummaryImplSP summary
) {
134 m_summary_sp
= summary
;
138 DumpValueObjectOptions
&
139 DumpValueObjectOptions::SetRootValueObjectName(const char *name
) {
141 m_root_valobj_name
.assign(name
);
143 m_root_valobj_name
.clear();
147 DumpValueObjectOptions
&
148 DumpValueObjectOptions::SetHideRootType(bool hide_root_type
) {
149 m_hide_root_type
= hide_root_type
;
153 DumpValueObjectOptions
&
154 DumpValueObjectOptions::SetHideRootName(bool hide_root_name
) {
155 m_hide_root_name
= hide_root_name
;
159 DumpValueObjectOptions
&DumpValueObjectOptions::SetHideName(bool hide_name
) {
160 m_hide_name
= hide_name
;
164 DumpValueObjectOptions
&DumpValueObjectOptions::SetHideValue(bool hide_value
) {
165 m_hide_value
= hide_value
;
169 DumpValueObjectOptions
&DumpValueObjectOptions::SetHidePointerValue(bool hide
) {
170 m_hide_pointer_value
= hide
;
174 DumpValueObjectOptions
&
175 DumpValueObjectOptions::SetVariableFormatDisplayLanguage(
176 lldb::LanguageType lang
) {
177 m_varformat_language
= lang
;
181 DumpValueObjectOptions
&DumpValueObjectOptions::SetRunValidator(bool run
) {
182 m_run_validator
= run
;
186 DumpValueObjectOptions
&
187 DumpValueObjectOptions::SetUseTypeDisplayName(bool dis
) {
188 m_use_type_display_name
= dis
;
192 DumpValueObjectOptions
&
193 DumpValueObjectOptions::SetAllowOnelinerMode(bool oneliner
) {
194 m_allow_oneliner_mode
= oneliner
;
198 DumpValueObjectOptions
&
199 DumpValueObjectOptions::SetRevealEmptyAggregates(bool reveal
) {
200 m_reveal_empty_aggregates
= reveal
;
204 DumpValueObjectOptions
&
205 DumpValueObjectOptions::SetElementCount(uint32_t element_count
) {
206 m_pointer_as_array
= PointerAsArraySettings(element_count
);
210 DumpValueObjectOptions
&DumpValueObjectOptions::SetPointerAsArray(
211 const PointerAsArraySettings
&ptr_array
) {
212 m_pointer_as_array
= ptr_array
;