Path: blob/main/contrib/llvm-project/lldb/source/DataFormatters/DumpValueObjectOptions.cpp
39587 views
//===-- DumpValueObjectOptions.cpp ----------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/DataFormatters/DumpValueObjectOptions.h"910#include "lldb/Core/ValueObject.h"1112using namespace lldb;13using namespace lldb_private;1415DumpValueObjectOptions::DumpValueObjectOptions()16: m_summary_sp(), m_root_valobj_name(),17m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default, 0}),18m_decl_printing_helper(), m_child_printing_decider(),19m_pointer_as_array(), m_use_synthetic(true),20m_scope_already_checked(false), m_flat_output(false), m_ignore_cap(false),21m_show_types(false), m_show_location(false), m_use_objc(false),22m_hide_root_type(false), m_hide_root_name(false), m_hide_name(false),23m_hide_value(false), m_run_validator(false),24m_use_type_display_name(true), m_allow_oneliner_mode(true),25m_hide_pointer_value(false), m_reveal_empty_aggregates(true) {}2627DumpValueObjectOptions::DumpValueObjectOptions(ValueObject &valobj)28: DumpValueObjectOptions() {29m_use_dynamic = valobj.GetDynamicValueType();30m_use_synthetic = valobj.IsSynthetic();31m_varformat_language = valobj.GetPreferredDisplayLanguage();32}3334DumpValueObjectOptions &35DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth) {36m_max_ptr_depth = depth;37return *this;38}3940DumpValueObjectOptions &41DumpValueObjectOptions::SetMaximumDepth(uint32_t depth, bool is_default) {42m_max_depth = depth;43m_max_depth_is_default = is_default;44return *this;45}4647DumpValueObjectOptions &48DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper) {49m_decl_printing_helper = helper;50return *this;51}5253DumpValueObjectOptions &54DumpValueObjectOptions::SetChildPrintingDecider(ChildPrintingDecider decider) {55m_child_printing_decider = decider;56return *this;57}5859DumpValueObjectOptions &DumpValueObjectOptions::SetShowTypes(bool show) {60m_show_types = show;61return *this;62}6364DumpValueObjectOptions &DumpValueObjectOptions::SetShowLocation(bool show) {65m_show_location = show;66return *this;67}6869DumpValueObjectOptions &DumpValueObjectOptions::SetUseObjectiveC(bool use) {70m_use_objc = use;71return *this;72}7374DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) {75if (!show)76SetOmitSummaryDepth(UINT32_MAX);77else78SetOmitSummaryDepth(0);79return *this;80}8182DumpValueObjectOptions &83DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn) {84m_use_dynamic = dyn;85return *this;86}8788DumpValueObjectOptions &89DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic) {90m_use_synthetic = use_synthetic;91return *this;92}9394DumpValueObjectOptions &DumpValueObjectOptions::SetScopeChecked(bool check) {95m_scope_already_checked = check;96return *this;97}9899DumpValueObjectOptions &DumpValueObjectOptions::SetFlatOutput(bool flat) {100m_flat_output = flat;101return *this;102}103104DumpValueObjectOptions &105DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth) {106m_omit_summary_depth = depth;107return *this;108}109110DumpValueObjectOptions &DumpValueObjectOptions::SetIgnoreCap(bool ignore) {111m_ignore_cap = ignore;112return *this;113}114115DumpValueObjectOptions &DumpValueObjectOptions::SetRawDisplay() {116SetUseSyntheticValue(false);117SetOmitSummaryDepth(UINT32_MAX);118SetIgnoreCap(true);119SetHideName(false);120SetHideValue(false);121SetUseTypeDisplayName(false);122SetAllowOnelinerMode(false);123return *this;124}125126DumpValueObjectOptions &DumpValueObjectOptions::SetFormat(lldb::Format format) {127m_format = format;128return *this;129}130131DumpValueObjectOptions &132DumpValueObjectOptions::SetSummary(lldb::TypeSummaryImplSP summary) {133m_summary_sp = summary;134return *this;135}136137DumpValueObjectOptions &138DumpValueObjectOptions::SetRootValueObjectName(const char *name) {139if (name)140m_root_valobj_name.assign(name);141else142m_root_valobj_name.clear();143return *this;144}145146DumpValueObjectOptions &147DumpValueObjectOptions::SetHideRootType(bool hide_root_type) {148m_hide_root_type = hide_root_type;149return *this;150}151152DumpValueObjectOptions &153DumpValueObjectOptions::SetHideRootName(bool hide_root_name) {154m_hide_root_name = hide_root_name;155return *this;156}157158DumpValueObjectOptions &DumpValueObjectOptions::SetHideName(bool hide_name) {159m_hide_name = hide_name;160return *this;161}162163DumpValueObjectOptions &DumpValueObjectOptions::SetHideValue(bool hide_value) {164m_hide_value = hide_value;165return *this;166}167168DumpValueObjectOptions &DumpValueObjectOptions::SetHidePointerValue(bool hide) {169m_hide_pointer_value = hide;170return *this;171}172173DumpValueObjectOptions &174DumpValueObjectOptions::SetVariableFormatDisplayLanguage(175lldb::LanguageType lang) {176m_varformat_language = lang;177return *this;178}179180DumpValueObjectOptions &DumpValueObjectOptions::SetRunValidator(bool run) {181m_run_validator = run;182return *this;183}184185DumpValueObjectOptions &186DumpValueObjectOptions::SetUseTypeDisplayName(bool dis) {187m_use_type_display_name = dis;188return *this;189}190191DumpValueObjectOptions &192DumpValueObjectOptions::SetAllowOnelinerMode(bool oneliner) {193m_allow_oneliner_mode = oneliner;194return *this;195}196197DumpValueObjectOptions &198DumpValueObjectOptions::SetRevealEmptyAggregates(bool reveal) {199m_reveal_empty_aggregates = reveal;200return *this;201}202203DumpValueObjectOptions &204DumpValueObjectOptions::SetElementCount(uint32_t element_count) {205m_pointer_as_array = PointerAsArraySettings(element_count);206return *this;207}208209DumpValueObjectOptions &DumpValueObjectOptions::SetPointerAsArray(210const PointerAsArraySettings &ptr_array) {211m_pointer_as_array = ptr_array;212return *this;213}214215216