]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/API/SBVariablesOptions.cpp
Merge lldb trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / API / SBVariablesOptions.cpp
1 //===-- SBVariablesOptions.cpp --------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "lldb/API/SBVariablesOptions.h"
11 #include "SBReproducerPrivate.h"
12 #include "lldb/API/SBTarget.h"
13 #include "lldb/Target/Target.h"
14
15 #include "lldb/lldb-private.h"
16
17 using namespace lldb;
18 using namespace lldb_private;
19
20 class VariablesOptionsImpl {
21 public:
22   VariablesOptionsImpl()
23       : m_include_arguments(false), m_include_locals(false),
24         m_include_statics(false), m_in_scope_only(false),
25         m_include_runtime_support_values(false),
26         m_include_recognized_arguments(eLazyBoolCalculate),
27         m_use_dynamic(lldb::eNoDynamicValues) {}
28
29   VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
30
31   ~VariablesOptionsImpl() = default;
32
33   VariablesOptionsImpl &operator=(const VariablesOptionsImpl &) = default;
34
35   bool GetIncludeArguments() const { return m_include_arguments; }
36
37   void SetIncludeArguments(bool b) { m_include_arguments = b; }
38
39   bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const {
40     if (m_include_recognized_arguments != eLazyBoolCalculate)
41         return m_include_recognized_arguments;
42     return target_sp ? target_sp->GetDisplayRecognizedArguments() : false;
43   }
44
45   void SetIncludeRecognizedArguments(bool b) {
46     m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
47   }
48
49   bool GetIncludeLocals() const { return m_include_locals; }
50
51   void SetIncludeLocals(bool b) { m_include_locals = b; }
52
53   bool GetIncludeStatics() const { return m_include_statics; }
54
55   void SetIncludeStatics(bool b) { m_include_statics = b; }
56
57   bool GetInScopeOnly() const { return m_in_scope_only; }
58
59   void SetInScopeOnly(bool b) { m_in_scope_only = b; }
60
61   bool GetIncludeRuntimeSupportValues() const {
62     return m_include_runtime_support_values;
63   }
64
65   void SetIncludeRuntimeSupportValues(bool b) {
66     m_include_runtime_support_values = b;
67   }
68
69   lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }
70
71   void SetUseDynamic(lldb::DynamicValueType d) { m_use_dynamic = d; }
72
73 private:
74   bool m_include_arguments : 1;
75   bool m_include_locals : 1;
76   bool m_include_statics : 1;
77   bool m_in_scope_only : 1;
78   bool m_include_runtime_support_values : 1;
79   LazyBool m_include_recognized_arguments; // can be overridden with a setting
80   lldb::DynamicValueType m_use_dynamic;
81 };
82
83 SBVariablesOptions::SBVariablesOptions()
84     : m_opaque_up(new VariablesOptionsImpl()) {
85   LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBVariablesOptions);
86 }
87
88 SBVariablesOptions::SBVariablesOptions(const SBVariablesOptions &options)
89     : m_opaque_up(new VariablesOptionsImpl(options.ref())) {
90   LLDB_RECORD_CONSTRUCTOR(SBVariablesOptions,
91                           (const lldb::SBVariablesOptions &), options);
92 }
93
94 SBVariablesOptions &SBVariablesOptions::
95 operator=(const SBVariablesOptions &options) {
96   LLDB_RECORD_METHOD(
97       lldb::SBVariablesOptions &,
98       SBVariablesOptions, operator=,(const lldb::SBVariablesOptions &),
99       options);
100
101   m_opaque_up.reset(new VariablesOptionsImpl(options.ref()));
102   return LLDB_RECORD_RESULT(*this);
103 }
104
105 SBVariablesOptions::~SBVariablesOptions() = default;
106
107 bool SBVariablesOptions::IsValid() const {
108   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, IsValid);
109   return this->operator bool();
110 }
111 SBVariablesOptions::operator bool() const {
112   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, operator bool);
113
114   return m_opaque_up != nullptr;
115 }
116
117 bool SBVariablesOptions::GetIncludeArguments() const {
118   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions,
119                                    GetIncludeArguments);
120
121   return m_opaque_up->GetIncludeArguments();
122 }
123
124 void SBVariablesOptions::SetIncludeArguments(bool arguments) {
125   LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeArguments, (bool),
126                      arguments);
127
128   m_opaque_up->SetIncludeArguments(arguments);
129 }
130
131 bool SBVariablesOptions::GetIncludeRecognizedArguments(
132     const lldb::SBTarget &target) const {
133   LLDB_RECORD_METHOD_CONST(bool, SBVariablesOptions,
134                            GetIncludeRecognizedArguments,
135                            (const lldb::SBTarget &), target);
136
137   return m_opaque_up->GetIncludeRecognizedArguments(target.GetSP());
138 }
139
140 void SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) {
141   LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeRecognizedArguments,
142                      (bool), arguments);
143
144   m_opaque_up->SetIncludeRecognizedArguments(arguments);
145 }
146
147 bool SBVariablesOptions::GetIncludeLocals() const {
148   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetIncludeLocals);
149
150   return m_opaque_up->GetIncludeLocals();
151 }
152
153 void SBVariablesOptions::SetIncludeLocals(bool locals) {
154   LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeLocals, (bool),
155                      locals);
156
157   m_opaque_up->SetIncludeLocals(locals);
158 }
159
160 bool SBVariablesOptions::GetIncludeStatics() const {
161   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetIncludeStatics);
162
163   return m_opaque_up->GetIncludeStatics();
164 }
165
166 void SBVariablesOptions::SetIncludeStatics(bool statics) {
167   LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeStatics, (bool),
168                      statics);
169
170   m_opaque_up->SetIncludeStatics(statics);
171 }
172
173 bool SBVariablesOptions::GetInScopeOnly() const {
174   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetInScopeOnly);
175
176   return m_opaque_up->GetInScopeOnly();
177 }
178
179 void SBVariablesOptions::SetInScopeOnly(bool in_scope_only) {
180   LLDB_RECORD_METHOD(void, SBVariablesOptions, SetInScopeOnly, (bool),
181                      in_scope_only);
182
183   m_opaque_up->SetInScopeOnly(in_scope_only);
184 }
185
186 bool SBVariablesOptions::GetIncludeRuntimeSupportValues() const {
187   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions,
188                                    GetIncludeRuntimeSupportValues);
189
190   return m_opaque_up->GetIncludeRuntimeSupportValues();
191 }
192
193 void SBVariablesOptions::SetIncludeRuntimeSupportValues(
194     bool runtime_support_values) {
195   LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeRuntimeSupportValues,
196                      (bool), runtime_support_values);
197
198   m_opaque_up->SetIncludeRuntimeSupportValues(runtime_support_values);
199 }
200
201 lldb::DynamicValueType SBVariablesOptions::GetUseDynamic() const {
202   LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::DynamicValueType, SBVariablesOptions,
203                                    GetUseDynamic);
204
205   return m_opaque_up->GetUseDynamic();
206 }
207
208 void SBVariablesOptions::SetUseDynamic(lldb::DynamicValueType dynamic) {
209   LLDB_RECORD_METHOD(void, SBVariablesOptions, SetUseDynamic,
210                      (lldb::DynamicValueType), dynamic);
211
212   m_opaque_up->SetUseDynamic(dynamic);
213 }
214
215 VariablesOptionsImpl *SBVariablesOptions::operator->() {
216   return m_opaque_up.operator->();
217 }
218
219 const VariablesOptionsImpl *SBVariablesOptions::operator->() const {
220   return m_opaque_up.operator->();
221 }
222
223 VariablesOptionsImpl *SBVariablesOptions::get() { return m_opaque_up.get(); }
224
225 VariablesOptionsImpl &SBVariablesOptions::ref() { return *m_opaque_up; }
226
227 const VariablesOptionsImpl &SBVariablesOptions::ref() const {
228   return *m_opaque_up;
229 }
230
231 SBVariablesOptions::SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr)
232     : m_opaque_up(std::move(lldb_object_ptr)) {}
233
234 void SBVariablesOptions::SetOptions(VariablesOptionsImpl *lldb_object_ptr) {
235   m_opaque_up.reset(std::move(lldb_object_ptr));
236 }
237
238 namespace lldb_private {
239 namespace repro {
240
241 template <>
242 void RegisterMethods<SBVariablesOptions>(Registry &R) {
243   LLDB_REGISTER_CONSTRUCTOR(SBVariablesOptions, ());
244   LLDB_REGISTER_CONSTRUCTOR(SBVariablesOptions,
245                             (const lldb::SBVariablesOptions &));
246   LLDB_REGISTER_METHOD(
247       lldb::SBVariablesOptions &,
248       SBVariablesOptions, operator=,(const lldb::SBVariablesOptions &));
249   LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, IsValid, ());
250   LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, operator bool, ());
251   LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, GetIncludeArguments,
252                              ());
253   LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetIncludeArguments, (bool));
254   LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions,
255                              GetIncludeRecognizedArguments,
256                              (const lldb::SBTarget &));
257   LLDB_REGISTER_METHOD(void, SBVariablesOptions,
258                        SetIncludeRecognizedArguments, (bool));
259   LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, GetIncludeLocals, ());
260   LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetIncludeLocals, (bool));
261   LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, GetIncludeStatics, ());
262   LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetIncludeStatics, (bool));
263   LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, GetInScopeOnly, ());
264   LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetInScopeOnly, (bool));
265   LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions,
266                              GetIncludeRuntimeSupportValues, ());
267   LLDB_REGISTER_METHOD(void, SBVariablesOptions,
268                        SetIncludeRuntimeSupportValues, (bool));
269   LLDB_REGISTER_METHOD_CONST(lldb::DynamicValueType, SBVariablesOptions,
270                              GetUseDynamic, ());
271   LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetUseDynamic,
272                        (lldb::DynamicValueType));
273 }
274
275 }
276 }