]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/DataFormatters/DumpValueObjectOptions.cpp
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / DataFormatters / DumpValueObjectOptions.cpp
1 //===-- DumpValueObjectOptions.cpp -----------------------------------*- C++
2 //-*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #include "lldb/DataFormatters/DumpValueObjectOptions.h"
12
13 #include "lldb/Core/ValueObject.h"
14
15 using namespace lldb;
16 using namespace lldb_private;
17
18 DumpValueObjectOptions::DumpValueObjectOptions()
19     : m_summary_sp(), m_root_valobj_name(),
20       m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default, 0}),
21       m_decl_printing_helper(), m_pointer_as_array(), m_use_synthetic(true),
22       m_scope_already_checked(false), m_flat_output(false), m_ignore_cap(false),
23       m_show_types(false), m_show_location(false), m_use_objc(false),
24       m_hide_root_type(false), m_hide_name(false), m_hide_value(false),
25       m_run_validator(false), m_use_type_display_name(true),
26       m_allow_oneliner_mode(true), m_hide_pointer_value(false),
27       m_reveal_empty_aggregates(true) {}
28
29 DumpValueObjectOptions::DumpValueObjectOptions(ValueObject &valobj)
30     : DumpValueObjectOptions() {
31   m_use_dynamic = valobj.GetDynamicValueType();
32   m_use_synthetic = valobj.IsSynthetic();
33   m_varformat_language = valobj.GetPreferredDisplayLanguage();
34 }
35
36 DumpValueObjectOptions &
37 DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth) {
38   m_max_ptr_depth = depth;
39   return *this;
40 }
41
42 DumpValueObjectOptions &
43 DumpValueObjectOptions::SetMaximumDepth(uint32_t depth) {
44   m_max_depth = depth;
45   return *this;
46 }
47
48 DumpValueObjectOptions &
49 DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper) {
50   m_decl_printing_helper = helper;
51   return *this;
52 }
53
54 DumpValueObjectOptions &DumpValueObjectOptions::SetShowTypes(bool show) {
55   m_show_types = show;
56   return *this;
57 }
58
59 DumpValueObjectOptions &DumpValueObjectOptions::SetShowLocation(bool show) {
60   m_show_location = show;
61   return *this;
62 }
63
64 DumpValueObjectOptions &DumpValueObjectOptions::SetUseObjectiveC(bool use) {
65   m_use_objc = use;
66   return *this;
67 }
68
69 DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) {
70   if (!show)
71     SetOmitSummaryDepth(UINT32_MAX);
72   else
73     SetOmitSummaryDepth(0);
74   return *this;
75 }
76
77 DumpValueObjectOptions &
78 DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn) {
79   m_use_dynamic = dyn;
80   return *this;
81 }
82
83 DumpValueObjectOptions &
84 DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic) {
85   m_use_synthetic = use_synthetic;
86   return *this;
87 }
88
89 DumpValueObjectOptions &DumpValueObjectOptions::SetScopeChecked(bool check) {
90   m_scope_already_checked = check;
91   return *this;
92 }
93
94 DumpValueObjectOptions &DumpValueObjectOptions::SetFlatOutput(bool flat) {
95   m_flat_output = flat;
96   return *this;
97 }
98
99 DumpValueObjectOptions &
100 DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth) {
101   m_omit_summary_depth = depth;
102   return *this;
103 }
104
105 DumpValueObjectOptions &DumpValueObjectOptions::SetIgnoreCap(bool ignore) {
106   m_ignore_cap = ignore;
107   return *this;
108 }
109
110 DumpValueObjectOptions &DumpValueObjectOptions::SetRawDisplay() {
111   SetUseSyntheticValue(false);
112   SetOmitSummaryDepth(UINT32_MAX);
113   SetIgnoreCap(true);
114   SetHideName(false);
115   SetHideValue(false);
116   SetUseTypeDisplayName(false);
117   SetAllowOnelinerMode(false);
118   return *this;
119 }
120
121 DumpValueObjectOptions &DumpValueObjectOptions::SetFormat(lldb::Format format) {
122   m_format = format;
123   return *this;
124 }
125
126 DumpValueObjectOptions &
127 DumpValueObjectOptions::SetSummary(lldb::TypeSummaryImplSP summary) {
128   m_summary_sp = summary;
129   return *this;
130 }
131
132 DumpValueObjectOptions &
133 DumpValueObjectOptions::SetRootValueObjectName(const char *name) {
134   if (name)
135     m_root_valobj_name.assign(name);
136   else
137     m_root_valobj_name.clear();
138   return *this;
139 }
140
141 DumpValueObjectOptions &
142 DumpValueObjectOptions::SetHideRootType(bool hide_root_type) {
143   m_hide_root_type = hide_root_type;
144   return *this;
145 }
146
147 DumpValueObjectOptions &DumpValueObjectOptions::SetHideName(bool hide_name) {
148   m_hide_name = hide_name;
149   return *this;
150 }
151
152 DumpValueObjectOptions &DumpValueObjectOptions::SetHideValue(bool hide_value) {
153   m_hide_value = hide_value;
154   return *this;
155 }
156
157 DumpValueObjectOptions &DumpValueObjectOptions::SetHidePointerValue(bool hide) {
158   m_hide_pointer_value = hide;
159   return *this;
160 }
161
162 DumpValueObjectOptions &
163 DumpValueObjectOptions::SetVariableFormatDisplayLanguage(
164     lldb::LanguageType lang) {
165   m_varformat_language = lang;
166   return *this;
167 }
168
169 DumpValueObjectOptions &DumpValueObjectOptions::SetRunValidator(bool run) {
170   m_run_validator = run;
171   return *this;
172 }
173
174 DumpValueObjectOptions &
175 DumpValueObjectOptions::SetUseTypeDisplayName(bool dis) {
176   m_use_type_display_name = dis;
177   return *this;
178 }
179
180 DumpValueObjectOptions &
181 DumpValueObjectOptions::SetAllowOnelinerMode(bool oneliner) {
182   m_allow_oneliner_mode = oneliner;
183   return *this;
184 }
185
186 DumpValueObjectOptions &
187 DumpValueObjectOptions::SetRevealEmptyAggregates(bool reveal) {
188   m_reveal_empty_aggregates = reveal;
189   return *this;
190 }
191
192 DumpValueObjectOptions &
193 DumpValueObjectOptions::SetElementCount(uint32_t element_count) {
194   m_pointer_as_array = PointerAsArraySettings(element_count);
195   return *this;
196 }
197
198 DumpValueObjectOptions &DumpValueObjectOptions::SetPointerAsArray(
199     const PointerAsArraySettings &ptr_array) {
200   m_pointer_as_array = ptr_array;
201   return *this;
202 }