blob: f3de1257bb809a3db3b5dc136ea1419487692c2b [file] [log] [blame]
Enrico Granatac8e76492015-10-19 22:04:25 +00001//===-- DumpValueObjectOptions.cpp -----------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "lldb/DataFormatters/DumpValueObjectOptions.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15// Project includes
16#include "lldb/Core/ValueObject.h"
17
18using namespace lldb;
19using namespace lldb_private;
20
21DumpValueObjectOptions::DumpValueObjectOptions() :
Enrico Granatac26332a2015-11-13 21:37:47 +000022 m_summary_sp(),
23 m_root_valobj_name(),
24 m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default,0}),
25 m_decl_printing_helper(),
26 m_use_synthetic(true),
27 m_scope_already_checked(false),
28 m_flat_output(false),
29 m_ignore_cap(false),
30 m_show_types(false),
31 m_show_location(false),
32 m_use_objc(false),
33 m_hide_root_type(false),
34 m_hide_name(false),
35 m_hide_value(false),
36 m_run_validator(false),
37 m_use_type_display_name(true),
38 m_allow_oneliner_mode(true),
39 m_hide_pointer_value(false),
40 m_reveal_empty_aggregates(true)
Enrico Granatac8e76492015-10-19 22:04:25 +000041{}
42
43
44DumpValueObjectOptions::DumpValueObjectOptions (ValueObject& valobj) :
Enrico Granatac26332a2015-11-13 21:37:47 +000045 DumpValueObjectOptions()
Enrico Granatac8e76492015-10-19 22:04:25 +000046{
47 m_use_dynamic = valobj.GetDynamicValueType();
48 m_use_synthetic = valobj.IsSynthetic();
49 m_varformat_language = valobj.GetPreferredDisplayLanguage();
50}
51
52DumpValueObjectOptions&
53DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth)
54{
55 m_max_ptr_depth = depth;
56 return *this;
57}
58
59DumpValueObjectOptions&
60DumpValueObjectOptions::SetMaximumDepth(uint32_t depth)
61{
62 m_max_depth = depth;
63 return *this;
64}
65
66DumpValueObjectOptions&
67DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper)
68{
69 m_decl_printing_helper = helper;
70 return *this;
71}
72
73DumpValueObjectOptions&
74DumpValueObjectOptions::SetShowTypes(bool show)
75{
76 m_show_types = show;
77 return *this;
78}
79
80DumpValueObjectOptions&
81DumpValueObjectOptions::SetShowLocation(bool show)
82{
83 m_show_location = show;
84 return *this;
85}
86
87DumpValueObjectOptions&
88DumpValueObjectOptions::SetUseObjectiveC(bool use)
89{
90 m_use_objc = use;
91 return *this;
92}
93
94DumpValueObjectOptions&
95DumpValueObjectOptions::SetShowSummary(bool show)
96{
97 if (show == false)
98 SetOmitSummaryDepth(UINT32_MAX);
99 else
100 SetOmitSummaryDepth(0);
101 return *this;
102}
103
104DumpValueObjectOptions&
105DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn)
106{
107 m_use_dynamic = dyn;
108 return *this;
109}
110
111DumpValueObjectOptions&
112DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic)
113{
114 m_use_synthetic = use_synthetic;
115 return *this;
116}
117
118DumpValueObjectOptions&
119DumpValueObjectOptions::SetScopeChecked(bool check)
120{
121 m_scope_already_checked = check;
122 return *this;
123}
124
125DumpValueObjectOptions&
126DumpValueObjectOptions::SetFlatOutput(bool flat)
127{
128 m_flat_output = flat;
129 return *this;
130}
131
132DumpValueObjectOptions&
133DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth)
134{
135 m_omit_summary_depth = depth;
136 return *this;
137}
138
139DumpValueObjectOptions&
140DumpValueObjectOptions::SetIgnoreCap(bool ignore)
141{
142 m_ignore_cap = ignore;
143 return *this;
144}
145
146DumpValueObjectOptions&
147DumpValueObjectOptions::SetRawDisplay()
148{
149 SetUseSyntheticValue(false);
150 SetOmitSummaryDepth(UINT32_MAX);
151 SetIgnoreCap(true);
152 SetHideName(false);
153 SetHideValue(false);
154 SetUseTypeDisplayName(false);
155 SetAllowOnelinerMode(false);
156 return *this;
157}
158
159DumpValueObjectOptions&
160DumpValueObjectOptions::SetFormat (lldb::Format format)
161{
162 m_format = format;
163 return *this;
164}
165
166DumpValueObjectOptions&
167DumpValueObjectOptions::SetSummary (lldb::TypeSummaryImplSP summary)
168{
169 m_summary_sp = summary;
170 return *this;
171}
172
173DumpValueObjectOptions&
174DumpValueObjectOptions::SetRootValueObjectName (const char* name)
175{
176 if (name)
177 m_root_valobj_name.assign(name);
178 else
179 m_root_valobj_name.clear();
180 return *this;
181}
182
183DumpValueObjectOptions&
184DumpValueObjectOptions::SetHideRootType (bool hide_root_type)
185{
186 m_hide_root_type = hide_root_type;
187 return *this;
188}
189
190DumpValueObjectOptions&
191DumpValueObjectOptions::SetHideName (bool hide_name)
192{
193 m_hide_name = hide_name;
194 return *this;
195}
196
197DumpValueObjectOptions&
198DumpValueObjectOptions::SetHideValue (bool hide_value)
199{
200 m_hide_value = hide_value;
201 return *this;
202}
203
204DumpValueObjectOptions&
205DumpValueObjectOptions::SetHidePointerValue (bool hide)
206{
207 m_hide_pointer_value = hide;
208 return *this;
209}
210
211DumpValueObjectOptions&
212DumpValueObjectOptions::SetVariableFormatDisplayLanguage (lldb::LanguageType lang)
213{
214 m_varformat_language = lang;
215 return *this;
216}
217
218DumpValueObjectOptions&
219DumpValueObjectOptions::SetRunValidator (bool run)
220{
221 m_run_validator = run;
222 return *this;
223}
224
225DumpValueObjectOptions&
226DumpValueObjectOptions::SetUseTypeDisplayName (bool dis)
227{
228 m_use_type_display_name = dis;
229 return *this;
230}
231
232DumpValueObjectOptions&
233DumpValueObjectOptions::SetAllowOnelinerMode (bool oneliner)
234{
235 m_allow_oneliner_mode = oneliner;
236 return *this;
237}
Enrico Granata8cf44d92015-11-10 19:07:58 +0000238
239DumpValueObjectOptions&
240DumpValueObjectOptions::SetRevealEmptyAggregates (bool reveal)
241{
242 m_reveal_empty_aggregates = reveal;
243 return *this;
244}
Enrico Granatac26332a2015-11-13 21:37:47 +0000245