blob: d22783422ea2fc0ac00de53e581ea3d4c7c006ce [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() :
22 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{}
41
42
43DumpValueObjectOptions::DumpValueObjectOptions (ValueObject& valobj) :
44 DumpValueObjectOptions()
45{
46 m_use_dynamic = valobj.GetDynamicValueType();
47 m_use_synthetic = valobj.IsSynthetic();
48 m_varformat_language = valobj.GetPreferredDisplayLanguage();
49}
50
51DumpValueObjectOptions&
52DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth)
53{
54 m_max_ptr_depth = depth;
55 return *this;
56}
57
58DumpValueObjectOptions&
59DumpValueObjectOptions::SetMaximumDepth(uint32_t depth)
60{
61 m_max_depth = depth;
62 return *this;
63}
64
65DumpValueObjectOptions&
66DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper)
67{
68 m_decl_printing_helper = helper;
69 return *this;
70}
71
72DumpValueObjectOptions&
73DumpValueObjectOptions::SetShowTypes(bool show)
74{
75 m_show_types = show;
76 return *this;
77}
78
79DumpValueObjectOptions&
80DumpValueObjectOptions::SetShowLocation(bool show)
81{
82 m_show_location = show;
83 return *this;
84}
85
86DumpValueObjectOptions&
87DumpValueObjectOptions::SetUseObjectiveC(bool use)
88{
89 m_use_objc = use;
90 return *this;
91}
92
93DumpValueObjectOptions&
94DumpValueObjectOptions::SetShowSummary(bool show)
95{
96 if (show == false)
97 SetOmitSummaryDepth(UINT32_MAX);
98 else
99 SetOmitSummaryDepth(0);
100 return *this;
101}
102
103DumpValueObjectOptions&
104DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn)
105{
106 m_use_dynamic = dyn;
107 return *this;
108}
109
110DumpValueObjectOptions&
111DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic)
112{
113 m_use_synthetic = use_synthetic;
114 return *this;
115}
116
117DumpValueObjectOptions&
118DumpValueObjectOptions::SetScopeChecked(bool check)
119{
120 m_scope_already_checked = check;
121 return *this;
122}
123
124DumpValueObjectOptions&
125DumpValueObjectOptions::SetFlatOutput(bool flat)
126{
127 m_flat_output = flat;
128 return *this;
129}
130
131DumpValueObjectOptions&
132DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth)
133{
134 m_omit_summary_depth = depth;
135 return *this;
136}
137
138DumpValueObjectOptions&
139DumpValueObjectOptions::SetIgnoreCap(bool ignore)
140{
141 m_ignore_cap = ignore;
142 return *this;
143}
144
145DumpValueObjectOptions&
146DumpValueObjectOptions::SetRawDisplay()
147{
148 SetUseSyntheticValue(false);
149 SetOmitSummaryDepth(UINT32_MAX);
150 SetIgnoreCap(true);
151 SetHideName(false);
152 SetHideValue(false);
153 SetUseTypeDisplayName(false);
154 SetAllowOnelinerMode(false);
155 return *this;
156}
157
158DumpValueObjectOptions&
159DumpValueObjectOptions::SetFormat (lldb::Format format)
160{
161 m_format = format;
162 return *this;
163}
164
165DumpValueObjectOptions&
166DumpValueObjectOptions::SetSummary (lldb::TypeSummaryImplSP summary)
167{
168 m_summary_sp = summary;
169 return *this;
170}
171
172DumpValueObjectOptions&
173DumpValueObjectOptions::SetRootValueObjectName (const char* name)
174{
175 if (name)
176 m_root_valobj_name.assign(name);
177 else
178 m_root_valobj_name.clear();
179 return *this;
180}
181
182DumpValueObjectOptions&
183DumpValueObjectOptions::SetHideRootType (bool hide_root_type)
184{
185 m_hide_root_type = hide_root_type;
186 return *this;
187}
188
189DumpValueObjectOptions&
190DumpValueObjectOptions::SetHideName (bool hide_name)
191{
192 m_hide_name = hide_name;
193 return *this;
194}
195
196DumpValueObjectOptions&
197DumpValueObjectOptions::SetHideValue (bool hide_value)
198{
199 m_hide_value = hide_value;
200 return *this;
201}
202
203DumpValueObjectOptions&
204DumpValueObjectOptions::SetHidePointerValue (bool hide)
205{
206 m_hide_pointer_value = hide;
207 return *this;
208}
209
210DumpValueObjectOptions&
211DumpValueObjectOptions::SetVariableFormatDisplayLanguage (lldb::LanguageType lang)
212{
213 m_varformat_language = lang;
214 return *this;
215}
216
217DumpValueObjectOptions&
218DumpValueObjectOptions::SetRunValidator (bool run)
219{
220 m_run_validator = run;
221 return *this;
222}
223
224DumpValueObjectOptions&
225DumpValueObjectOptions::SetUseTypeDisplayName (bool dis)
226{
227 m_use_type_display_name = dis;
228 return *this;
229}
230
231DumpValueObjectOptions&
232DumpValueObjectOptions::SetAllowOnelinerMode (bool oneliner)
233{
234 m_allow_oneliner_mode = oneliner;
235 return *this;
236}