blob: 17f8d00ff4937526b2724bd0251dcd1653cc59e5 [file] [log] [blame]
Kate Stoneb9c1b512016-09-06 20:57:50 +00001//===-- DumpValueObjectOptions.cpp -----------------------------------*- C++
2//-*-===//
Enrico Granatac8e76492015-10-19 22:04:25 +00003//
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
Enrico Granatac8e76492015-10-19 22:04:25 +000013#include "lldb/Core/ValueObject.h"
14
15using namespace lldb;
16using namespace lldb_private;
17
Kate Stoneb9c1b512016-09-06 20:57:50 +000018DumpValueObjectOptions::DumpValueObjectOptions()
19 : m_summary_sp(), m_root_valobj_name(),
20 m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default, 0}),
Enrico Granata9ac0dac2016-11-04 18:15:39 +000021 m_decl_printing_helper(), m_pointer_as_array(), m_use_synthetic(true),
Kate Stoneb9c1b512016-09-06 20:57:50 +000022 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) {}
Enrico Granatac8e76492015-10-19 22:04:25 +000028
Kate Stoneb9c1b512016-09-06 20:57:50 +000029DumpValueObjectOptions::DumpValueObjectOptions(ValueObject &valobj)
30 : DumpValueObjectOptions() {
31 m_use_dynamic = valobj.GetDynamicValueType();
32 m_use_synthetic = valobj.IsSynthetic();
33 m_varformat_language = valobj.GetPreferredDisplayLanguage();
Enrico Granatac8e76492015-10-19 22:04:25 +000034}
35
Kate Stoneb9c1b512016-09-06 20:57:50 +000036DumpValueObjectOptions &
37DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth) {
38 m_max_ptr_depth = depth;
39 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000040}
41
Kate Stoneb9c1b512016-09-06 20:57:50 +000042DumpValueObjectOptions &
43DumpValueObjectOptions::SetMaximumDepth(uint32_t depth) {
44 m_max_depth = depth;
45 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000046}
47
Kate Stoneb9c1b512016-09-06 20:57:50 +000048DumpValueObjectOptions &
49DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper) {
50 m_decl_printing_helper = helper;
51 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000052}
53
Kate Stoneb9c1b512016-09-06 20:57:50 +000054DumpValueObjectOptions &DumpValueObjectOptions::SetShowTypes(bool show) {
55 m_show_types = show;
56 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000057}
58
Kate Stoneb9c1b512016-09-06 20:57:50 +000059DumpValueObjectOptions &DumpValueObjectOptions::SetShowLocation(bool show) {
60 m_show_location = show;
61 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000062}
63
Kate Stoneb9c1b512016-09-06 20:57:50 +000064DumpValueObjectOptions &DumpValueObjectOptions::SetUseObjectiveC(bool use) {
65 m_use_objc = use;
66 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000067}
68
Kate Stoneb9c1b512016-09-06 20:57:50 +000069DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) {
Jonas Devliegherea6682a42018-12-15 00:15:33 +000070 if (!show)
Enrico Granatac8e76492015-10-19 22:04:25 +000071 SetOmitSummaryDepth(UINT32_MAX);
Kate Stoneb9c1b512016-09-06 20:57:50 +000072 else
73 SetOmitSummaryDepth(0);
74 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000075}
76
Kate Stoneb9c1b512016-09-06 20:57:50 +000077DumpValueObjectOptions &
78DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn) {
79 m_use_dynamic = dyn;
80 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000081}
82
Kate Stoneb9c1b512016-09-06 20:57:50 +000083DumpValueObjectOptions &
84DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic) {
85 m_use_synthetic = use_synthetic;
86 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000087}
88
Kate Stoneb9c1b512016-09-06 20:57:50 +000089DumpValueObjectOptions &DumpValueObjectOptions::SetScopeChecked(bool check) {
90 m_scope_already_checked = check;
91 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000092}
93
Kate Stoneb9c1b512016-09-06 20:57:50 +000094DumpValueObjectOptions &DumpValueObjectOptions::SetFlatOutput(bool flat) {
95 m_flat_output = flat;
96 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000097}
98
Kate Stoneb9c1b512016-09-06 20:57:50 +000099DumpValueObjectOptions &
100DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth) {
101 m_omit_summary_depth = depth;
102 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000103}
104
Kate Stoneb9c1b512016-09-06 20:57:50 +0000105DumpValueObjectOptions &DumpValueObjectOptions::SetIgnoreCap(bool ignore) {
106 m_ignore_cap = ignore;
107 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000108}
109
Kate Stoneb9c1b512016-09-06 20:57:50 +0000110DumpValueObjectOptions &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;
Enrico Granatac8e76492015-10-19 22:04:25 +0000119}
120
Kate Stoneb9c1b512016-09-06 20:57:50 +0000121DumpValueObjectOptions &DumpValueObjectOptions::SetFormat(lldb::Format format) {
122 m_format = format;
123 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000124}
125
Kate Stoneb9c1b512016-09-06 20:57:50 +0000126DumpValueObjectOptions &
127DumpValueObjectOptions::SetSummary(lldb::TypeSummaryImplSP summary) {
128 m_summary_sp = summary;
129 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000130}
131
Kate Stoneb9c1b512016-09-06 20:57:50 +0000132DumpValueObjectOptions &
133DumpValueObjectOptions::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;
Enrico Granatac8e76492015-10-19 22:04:25 +0000139}
140
Kate Stoneb9c1b512016-09-06 20:57:50 +0000141DumpValueObjectOptions &
142DumpValueObjectOptions::SetHideRootType(bool hide_root_type) {
143 m_hide_root_type = hide_root_type;
144 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000145}
Enrico Granata8cf44d92015-11-10 19:07:58 +0000146
Kate Stoneb9c1b512016-09-06 20:57:50 +0000147DumpValueObjectOptions &DumpValueObjectOptions::SetHideName(bool hide_name) {
148 m_hide_name = hide_name;
149 return *this;
Enrico Granata8cf44d92015-11-10 19:07:58 +0000150}
Enrico Granata520a4222016-04-25 00:52:47 +0000151
Kate Stoneb9c1b512016-09-06 20:57:50 +0000152DumpValueObjectOptions &DumpValueObjectOptions::SetHideValue(bool hide_value) {
153 m_hide_value = hide_value;
154 return *this;
155}
156
157DumpValueObjectOptions &DumpValueObjectOptions::SetHidePointerValue(bool hide) {
158 m_hide_pointer_value = hide;
159 return *this;
160}
161
162DumpValueObjectOptions &
163DumpValueObjectOptions::SetVariableFormatDisplayLanguage(
164 lldb::LanguageType lang) {
165 m_varformat_language = lang;
166 return *this;
167}
168
169DumpValueObjectOptions &DumpValueObjectOptions::SetRunValidator(bool run) {
170 m_run_validator = run;
171 return *this;
172}
173
174DumpValueObjectOptions &
175DumpValueObjectOptions::SetUseTypeDisplayName(bool dis) {
176 m_use_type_display_name = dis;
177 return *this;
178}
179
180DumpValueObjectOptions &
181DumpValueObjectOptions::SetAllowOnelinerMode(bool oneliner) {
182 m_allow_oneliner_mode = oneliner;
183 return *this;
184}
185
186DumpValueObjectOptions &
187DumpValueObjectOptions::SetRevealEmptyAggregates(bool reveal) {
188 m_reveal_empty_aggregates = reveal;
189 return *this;
190}
191
192DumpValueObjectOptions &
193DumpValueObjectOptions::SetElementCount(uint32_t element_count) {
Enrico Granata9ac0dac2016-11-04 18:15:39 +0000194 m_pointer_as_array = PointerAsArraySettings(element_count);
195 return *this;
196}
197
198DumpValueObjectOptions &DumpValueObjectOptions::SetPointerAsArray(
199 const PointerAsArraySettings &ptr_array) {
200 m_pointer_as_array = ptr_array;
Kate Stoneb9c1b512016-09-06 20:57:50 +0000201 return *this;
Enrico Granata520a4222016-04-25 00:52:47 +0000202}