]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
MFV r318944: 8265 Reserve send stream flag for large dnode feature
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / DataFormatters / DumpValueObjectOptions.h
1 //===-- DumpValueObjectOptions.h --------------------------------*- 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 #ifndef lldb_DumpValueObjectOptions_h_
11 #define lldb_DumpValueObjectOptions_h_
12
13 // C Includes
14 // C++ Includes
15 #include <string>
16
17 // Other libraries and framework includes
18 // Project includes
19 #include "lldb/lldb-private.h"
20 #include "lldb/lldb-public.h"
21
22 #include <functional>
23 #include <string>
24
25 namespace lldb_private {
26
27 class DumpValueObjectOptions {
28 public:
29   struct PointerDepth {
30     enum class Mode { Always, Formatters, Default, Never } m_mode;
31     uint32_t m_count;
32
33     PointerDepth operator--() const {
34       if (m_count > 0)
35         return PointerDepth{m_mode, m_count - 1};
36       return PointerDepth{m_mode, m_count};
37     }
38
39     bool CanAllowExpansion() const;
40
41     bool CanAllowExpansion(bool is_root, TypeSummaryImpl *entry,
42                            ValueObject *valobj, const std::string &summary);
43   };
44
45   struct PointerAsArraySettings {
46     size_t m_element_count;
47     size_t m_base_element;
48     size_t m_stride;
49
50     PointerAsArraySettings()
51         : m_element_count(0), m_base_element(0), m_stride() {}
52
53     PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
54                            size_t stride = 1)
55         : m_element_count(elem_count), m_base_element(base_elem),
56           m_stride(stride) {}
57
58     operator bool() { return m_element_count > 0; }
59   };
60
61   typedef std::function<bool(ConstString, ConstString,
62                              const DumpValueObjectOptions &, Stream &)>
63       DeclPrintingHelper;
64
65   static const DumpValueObjectOptions DefaultOptions() {
66     static DumpValueObjectOptions g_default_options;
67
68     return g_default_options;
69   }
70
71   DumpValueObjectOptions();
72
73   DumpValueObjectOptions(const DumpValueObjectOptions &rhs) = default;
74
75   DumpValueObjectOptions(ValueObject &valobj);
76
77   DumpValueObjectOptions &
78   SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0});
79
80   DumpValueObjectOptions &SetMaximumDepth(uint32_t depth = 0);
81
82   DumpValueObjectOptions &SetDeclPrintingHelper(DeclPrintingHelper helper);
83
84   DumpValueObjectOptions &SetShowTypes(bool show = false);
85
86   DumpValueObjectOptions &SetShowLocation(bool show = false);
87
88   DumpValueObjectOptions &SetUseObjectiveC(bool use = false);
89
90   DumpValueObjectOptions &SetShowSummary(bool show = true);
91
92   DumpValueObjectOptions &
93   SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
94
95   DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true);
96
97   DumpValueObjectOptions &SetScopeChecked(bool check = true);
98
99   DumpValueObjectOptions &SetFlatOutput(bool flat = false);
100
101   DumpValueObjectOptions &SetOmitSummaryDepth(uint32_t depth = 0);
102
103   DumpValueObjectOptions &SetIgnoreCap(bool ignore = false);
104
105   DumpValueObjectOptions &SetRawDisplay();
106
107   DumpValueObjectOptions &SetFormat(lldb::Format format = lldb::eFormatDefault);
108
109   DumpValueObjectOptions &
110   SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
111
112   DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr);
113
114   DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false);
115
116   DumpValueObjectOptions &SetHideName(bool hide_name = false);
117
118   DumpValueObjectOptions &SetHideValue(bool hide_value = false);
119
120   DumpValueObjectOptions &SetHidePointerValue(bool hide = false);
121
122   DumpValueObjectOptions &SetVariableFormatDisplayLanguage(
123       lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
124
125   DumpValueObjectOptions &SetRunValidator(bool run = true);
126
127   DumpValueObjectOptions &SetUseTypeDisplayName(bool dis = false);
128
129   DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false);
130
131   DumpValueObjectOptions &SetRevealEmptyAggregates(bool reveal = true);
132
133   DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
134
135   DumpValueObjectOptions &
136   SetPointerAsArray(const PointerAsArraySettings &ptr_array);
137
138 public:
139   uint32_t m_max_depth = UINT32_MAX;
140   lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
141   uint32_t m_omit_summary_depth = 0;
142   lldb::Format m_format = lldb::eFormatDefault;
143   lldb::TypeSummaryImplSP m_summary_sp;
144   std::string m_root_valobj_name;
145   lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
146   PointerDepth m_max_ptr_depth;
147   DeclPrintingHelper m_decl_printing_helper;
148   PointerAsArraySettings m_pointer_as_array;
149   bool m_use_synthetic : 1;
150   bool m_scope_already_checked : 1;
151   bool m_flat_output : 1;
152   bool m_ignore_cap : 1;
153   bool m_show_types : 1;
154   bool m_show_location : 1;
155   bool m_use_objc : 1;
156   bool m_hide_root_type : 1;
157   bool m_hide_name : 1;
158   bool m_hide_value : 1;
159   bool m_run_validator : 1;
160   bool m_use_type_display_name : 1;
161   bool m_allow_oneliner_mode : 1;
162   bool m_hide_pointer_value : 1;
163   bool m_reveal_empty_aggregates : 1;
164 };
165
166 } // namespace lldb_private
167
168 #endif // lldb_DumpValueObjectOptions_h_