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