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