brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.1 KiB · e1df952 Raw
230 lines · cpp
1//===-- DumpValueObjectOptions.cpp ----------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "lldb/DataFormatters/DumpValueObjectOptions.h"10 11#include "lldb/ValueObject/ValueObject.h"12 13using namespace lldb;14using namespace lldb_private;15 16DumpValueObjectOptions::DumpValueObjectOptions()17    : m_summary_sp(), m_root_valobj_name(), m_decl_printing_helper(),18      m_child_printing_decider(), m_pointer_as_array(), m_use_synthetic(true),19      m_scope_already_checked(false), m_flat_output(false), m_ignore_cap(false),20      m_show_types(false), m_show_location(false), m_use_object_desc(false),21      m_hide_root_type(false), m_hide_root_name(false), m_hide_name(false),22      m_hide_value(false), m_run_validator(false),23      m_use_type_display_name(true), m_allow_oneliner_mode(true),24      m_hide_pointer_value(false), m_reveal_empty_aggregates(true) {}25 26DumpValueObjectOptions::DumpValueObjectOptions(ValueObject &valobj)27    : DumpValueObjectOptions() {28  m_use_dynamic = valobj.GetDynamicValueType();29  m_use_synthetic = valobj.IsSynthetic();30  m_varformat_language = valobj.GetPreferredDisplayLanguage();31}32 33DumpValueObjectOptions &34DumpValueObjectOptions::SetMaximumPointerDepth(uint32_t depth) {35  m_max_ptr_depth = {depth};36  return *this;37}38 39DumpValueObjectOptions &40DumpValueObjectOptions::SetMaximumDepth(uint32_t depth, bool is_default) {41  m_max_depth = depth;42  m_max_depth_is_default = is_default;43  return *this;44}45 46DumpValueObjectOptions &47DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper) {48  m_decl_printing_helper = helper;49  return *this;50}51 52DumpValueObjectOptions &53DumpValueObjectOptions::SetChildPrintingDecider(ChildPrintingDecider decider) {54  m_child_printing_decider = decider;55  return *this;56}57 58DumpValueObjectOptions &DumpValueObjectOptions::SetShowTypes(bool show) {59  m_show_types = show;60  return *this;61}62 63DumpValueObjectOptions &DumpValueObjectOptions::SetShowLocation(bool show) {64  m_show_location = show;65  return *this;66}67 68DumpValueObjectOptions &DumpValueObjectOptions::DisableObjectDescription() {69  // Reset these options to their default values.70  SetUseObjectDescription(false);71  SetHideRootType(false);72  SetHideName(false);73  SetHideValue(false);74  SetShowSummary(true);75  return *this;76}77 78DumpValueObjectOptions &79DumpValueObjectOptions::SetUseObjectDescription(bool use) {80  m_use_object_desc = use;81  return *this;82}83 84DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) {85  if (!show)86    SetOmitSummaryDepth(UINT32_MAX);87  else88    SetOmitSummaryDepth(0);89  return *this;90}91 92DumpValueObjectOptions &93DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn) {94  m_use_dynamic = dyn;95  return *this;96}97 98DumpValueObjectOptions &99DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic) {100  m_use_synthetic = use_synthetic;101  return *this;102}103 104DumpValueObjectOptions &DumpValueObjectOptions::SetScopeChecked(bool check) {105  m_scope_already_checked = check;106  return *this;107}108 109DumpValueObjectOptions &DumpValueObjectOptions::SetFlatOutput(bool flat) {110  m_flat_output = flat;111  return *this;112}113 114DumpValueObjectOptions &115DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth) {116  m_omit_summary_depth = depth;117  return *this;118}119 120DumpValueObjectOptions &DumpValueObjectOptions::SetIgnoreCap(bool ignore) {121  m_ignore_cap = ignore;122  return *this;123}124 125DumpValueObjectOptions &DumpValueObjectOptions::SetRawDisplay() {126  SetUseSyntheticValue(false);127  SetOmitSummaryDepth(UINT32_MAX);128  SetIgnoreCap(true);129  SetHideName(false);130  SetHideValue(false);131  SetUseTypeDisplayName(false);132  SetAllowOnelinerMode(false);133  return *this;134}135 136DumpValueObjectOptions &DumpValueObjectOptions::SetFormat(lldb::Format format) {137  m_format = format;138  return *this;139}140 141DumpValueObjectOptions &142DumpValueObjectOptions::SetSummary(lldb::TypeSummaryImplSP summary) {143  m_summary_sp = summary;144  return *this;145}146 147DumpValueObjectOptions &148DumpValueObjectOptions::SetRootValueObjectName(const char *name) {149  if (name)150    m_root_valobj_name.assign(name);151  else152    m_root_valobj_name.clear();153  return *this;154}155 156DumpValueObjectOptions &157DumpValueObjectOptions::SetHideRootType(bool hide_root_type) {158  m_hide_root_type = hide_root_type;159  return *this;160}161 162DumpValueObjectOptions &163DumpValueObjectOptions::SetHideRootName(bool hide_root_name) {164  m_hide_root_name = hide_root_name;165  return *this;166}167 168DumpValueObjectOptions &DumpValueObjectOptions::SetHideName(bool hide_name) {169  m_hide_name = hide_name;170  return *this;171}172 173DumpValueObjectOptions &DumpValueObjectOptions::SetHideValue(bool hide_value) {174  m_hide_value = hide_value;175  return *this;176}177 178DumpValueObjectOptions &DumpValueObjectOptions::SetHidePointerValue(bool hide) {179  m_hide_pointer_value = hide;180  return *this;181}182 183DumpValueObjectOptions &184DumpValueObjectOptions::SetVariableFormatDisplayLanguage(185    lldb::LanguageType lang) {186  m_varformat_language = lang;187  return *this;188}189 190DumpValueObjectOptions &DumpValueObjectOptions::SetRunValidator(bool run) {191  m_run_validator = run;192  return *this;193}194 195DumpValueObjectOptions &196DumpValueObjectOptions::SetUseTypeDisplayName(bool dis) {197  m_use_type_display_name = dis;198  return *this;199}200 201DumpValueObjectOptions &202DumpValueObjectOptions::SetAllowOnelinerMode(bool oneliner) {203  m_allow_oneliner_mode = oneliner;204  return *this;205}206 207DumpValueObjectOptions &208DumpValueObjectOptions::SetRevealEmptyAggregates(bool reveal) {209  m_reveal_empty_aggregates = reveal;210  return *this;211}212 213DumpValueObjectOptions &214DumpValueObjectOptions::SetExpandPointerTypeFlags(unsigned flags) {215  m_expand_ptr_type_flags = flags;216  return *this;217}218 219DumpValueObjectOptions &220DumpValueObjectOptions::SetElementCount(uint32_t element_count) {221  m_pointer_as_array = PointerAsArraySettings(element_count);222  return *this;223}224 225DumpValueObjectOptions &DumpValueObjectOptions::SetPointerAsArray(226    const PointerAsArraySettings &ptr_array) {227  m_pointer_as_array = ptr_array;228  return *this;229}230