1 //===-- DumpValueObjectOptions.cpp -----------------------------------*- C++
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #include "lldb/DataFormatters/DumpValueObjectOptions.h"
12 #include "lldb/Core/ValueObject.h"
15 using namespace lldb_private;
17 DumpValueObjectOptions::DumpValueObjectOptions()
18 : m_summary_sp(), m_root_valobj_name(),
19 m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default, 0}),
20 m_decl_printing_helper(), 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_name(false), m_hide_value(false),
24 m_run_validator(false), m_use_type_display_name(true),
25 m_allow_oneliner_mode(true), m_hide_pointer_value(false),
26 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) {
47 DumpValueObjectOptions &
48 DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper) {
49 m_decl_printing_helper = helper;
53 DumpValueObjectOptions &DumpValueObjectOptions::SetShowTypes(bool show) {
58 DumpValueObjectOptions &DumpValueObjectOptions::SetShowLocation(bool show) {
59 m_show_location = show;
63 DumpValueObjectOptions &DumpValueObjectOptions::SetUseObjectiveC(bool use) {
68 DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) {
70 SetOmitSummaryDepth(UINT32_MAX);
72 SetOmitSummaryDepth(0);
76 DumpValueObjectOptions &
77 DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn) {
82 DumpValueObjectOptions &
83 DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic) {
84 m_use_synthetic = use_synthetic;
88 DumpValueObjectOptions &DumpValueObjectOptions::SetScopeChecked(bool check) {
89 m_scope_already_checked = check;
93 DumpValueObjectOptions &DumpValueObjectOptions::SetFlatOutput(bool flat) {
98 DumpValueObjectOptions &
99 DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth) {
100 m_omit_summary_depth = depth;
104 DumpValueObjectOptions &DumpValueObjectOptions::SetIgnoreCap(bool ignore) {
105 m_ignore_cap = ignore;
109 DumpValueObjectOptions &DumpValueObjectOptions::SetRawDisplay() {
110 SetUseSyntheticValue(false);
111 SetOmitSummaryDepth(UINT32_MAX);
115 SetUseTypeDisplayName(false);
116 SetAllowOnelinerMode(false);
120 DumpValueObjectOptions &DumpValueObjectOptions::SetFormat(lldb::Format format) {
125 DumpValueObjectOptions &
126 DumpValueObjectOptions::SetSummary(lldb::TypeSummaryImplSP summary) {
127 m_summary_sp = summary;
131 DumpValueObjectOptions &
132 DumpValueObjectOptions::SetRootValueObjectName(const char *name) {
134 m_root_valobj_name.assign(name);
136 m_root_valobj_name.clear();
140 DumpValueObjectOptions &
141 DumpValueObjectOptions::SetHideRootType(bool hide_root_type) {
142 m_hide_root_type = hide_root_type;
146 DumpValueObjectOptions &DumpValueObjectOptions::SetHideName(bool hide_name) {
147 m_hide_name = hide_name;
151 DumpValueObjectOptions &DumpValueObjectOptions::SetHideValue(bool hide_value) {
152 m_hide_value = hide_value;
156 DumpValueObjectOptions &DumpValueObjectOptions::SetHidePointerValue(bool hide) {
157 m_hide_pointer_value = hide;
161 DumpValueObjectOptions &
162 DumpValueObjectOptions::SetVariableFormatDisplayLanguage(
163 lldb::LanguageType lang) {
164 m_varformat_language = lang;
168 DumpValueObjectOptions &DumpValueObjectOptions::SetRunValidator(bool run) {
169 m_run_validator = run;
173 DumpValueObjectOptions &
174 DumpValueObjectOptions::SetUseTypeDisplayName(bool dis) {
175 m_use_type_display_name = dis;
179 DumpValueObjectOptions &
180 DumpValueObjectOptions::SetAllowOnelinerMode(bool oneliner) {
181 m_allow_oneliner_mode = oneliner;
185 DumpValueObjectOptions &
186 DumpValueObjectOptions::SetRevealEmptyAggregates(bool reveal) {
187 m_reveal_empty_aggregates = reveal;
191 DumpValueObjectOptions &
192 DumpValueObjectOptions::SetElementCount(uint32_t element_count) {
193 m_pointer_as_array = PointerAsArraySettings(element_count);
197 DumpValueObjectOptions &DumpValueObjectOptions::SetPointerAsArray(
198 const PointerAsArraySettings &ptr_array) {
199 m_pointer_as_array = ptr_array;