[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / source / API / SBVariablesOptions.cpp
blobbf0197cd960bdd76bbafcf7a5f5e41c95e2da4f1
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 //===----------------------------------------------------------------------===//
10 #include "lldb/API/SBVariablesOptions.h"
11 #include "SBReproducerPrivate.h"
12 #include "lldb/API/SBTarget.h"
13 #include "lldb/Target/Target.h"
15 #include "lldb/lldb-private.h"
17 using namespace lldb;
18 using namespace lldb_private;
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) {}
29 VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
31 ~VariablesOptionsImpl() = default;
33 VariablesOptionsImpl &operator=(const VariablesOptionsImpl &) = default;
35 bool GetIncludeArguments() const { return m_include_arguments; }
37 void SetIncludeArguments(bool b) { m_include_arguments = b; }
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;
45 void SetIncludeRecognizedArguments(bool b) {
46 m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
49 bool GetIncludeLocals() const { return m_include_locals; }
51 void SetIncludeLocals(bool b) { m_include_locals = b; }
53 bool GetIncludeStatics() const { return m_include_statics; }
55 void SetIncludeStatics(bool b) { m_include_statics = b; }
57 bool GetInScopeOnly() const { return m_in_scope_only; }
59 void SetInScopeOnly(bool b) { m_in_scope_only = b; }
61 bool GetIncludeRuntimeSupportValues() const {
62 return m_include_runtime_support_values;
65 void SetIncludeRuntimeSupportValues(bool b) {
66 m_include_runtime_support_values = b;
69 lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }
71 void SetUseDynamic(lldb::DynamicValueType d) { m_use_dynamic = d; }
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;
83 SBVariablesOptions::SBVariablesOptions()
84 : m_opaque_up(new VariablesOptionsImpl()) {
85 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBVariablesOptions);
88 SBVariablesOptions::SBVariablesOptions(const SBVariablesOptions &options)
89 : m_opaque_up(new VariablesOptionsImpl(options.ref())) {
90 LLDB_RECORD_CONSTRUCTOR(SBVariablesOptions,
91 (const lldb::SBVariablesOptions &), options);
94 SBVariablesOptions &SBVariablesOptions::
95 operator=(const SBVariablesOptions &options) {
96 LLDB_RECORD_METHOD(
97 lldb::SBVariablesOptions &,
98 SBVariablesOptions, operator=,(const lldb::SBVariablesOptions &),
99 options);
101 m_opaque_up.reset(new VariablesOptionsImpl(options.ref()));
102 return LLDB_RECORD_RESULT(*this);
105 SBVariablesOptions::~SBVariablesOptions() = default;
107 bool SBVariablesOptions::IsValid() const {
108 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, IsValid);
109 return this->operator bool();
111 SBVariablesOptions::operator bool() const {
112 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, operator bool);
114 return m_opaque_up != nullptr;
117 bool SBVariablesOptions::GetIncludeArguments() const {
118 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions,
119 GetIncludeArguments);
121 return m_opaque_up->GetIncludeArguments();
124 void SBVariablesOptions::SetIncludeArguments(bool arguments) {
125 LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeArguments, (bool),
126 arguments);
128 m_opaque_up->SetIncludeArguments(arguments);
131 bool SBVariablesOptions::GetIncludeRecognizedArguments(
132 const lldb::SBTarget &target) const {
133 LLDB_RECORD_METHOD_CONST(bool, SBVariablesOptions,
134 GetIncludeRecognizedArguments,
135 (const lldb::SBTarget &), target);
137 return m_opaque_up->GetIncludeRecognizedArguments(target.GetSP());
140 void SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) {
141 LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeRecognizedArguments,
142 (bool), arguments);
144 m_opaque_up->SetIncludeRecognizedArguments(arguments);
147 bool SBVariablesOptions::GetIncludeLocals() const {
148 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetIncludeLocals);
150 return m_opaque_up->GetIncludeLocals();
153 void SBVariablesOptions::SetIncludeLocals(bool locals) {
154 LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeLocals, (bool),
155 locals);
157 m_opaque_up->SetIncludeLocals(locals);
160 bool SBVariablesOptions::GetIncludeStatics() const {
161 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetIncludeStatics);
163 return m_opaque_up->GetIncludeStatics();
166 void SBVariablesOptions::SetIncludeStatics(bool statics) {
167 LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeStatics, (bool),
168 statics);
170 m_opaque_up->SetIncludeStatics(statics);
173 bool SBVariablesOptions::GetInScopeOnly() const {
174 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetInScopeOnly);
176 return m_opaque_up->GetInScopeOnly();
179 void SBVariablesOptions::SetInScopeOnly(bool in_scope_only) {
180 LLDB_RECORD_METHOD(void, SBVariablesOptions, SetInScopeOnly, (bool),
181 in_scope_only);
183 m_opaque_up->SetInScopeOnly(in_scope_only);
186 bool SBVariablesOptions::GetIncludeRuntimeSupportValues() const {
187 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions,
188 GetIncludeRuntimeSupportValues);
190 return m_opaque_up->GetIncludeRuntimeSupportValues();
193 void SBVariablesOptions::SetIncludeRuntimeSupportValues(
194 bool runtime_support_values) {
195 LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeRuntimeSupportValues,
196 (bool), runtime_support_values);
198 m_opaque_up->SetIncludeRuntimeSupportValues(runtime_support_values);
201 lldb::DynamicValueType SBVariablesOptions::GetUseDynamic() const {
202 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::DynamicValueType, SBVariablesOptions,
203 GetUseDynamic);
205 return m_opaque_up->GetUseDynamic();
208 void SBVariablesOptions::SetUseDynamic(lldb::DynamicValueType dynamic) {
209 LLDB_RECORD_METHOD(void, SBVariablesOptions, SetUseDynamic,
210 (lldb::DynamicValueType), dynamic);
212 m_opaque_up->SetUseDynamic(dynamic);
215 VariablesOptionsImpl *SBVariablesOptions::operator->() {
216 return m_opaque_up.operator->();
219 const VariablesOptionsImpl *SBVariablesOptions::operator->() const {
220 return m_opaque_up.operator->();
223 VariablesOptionsImpl *SBVariablesOptions::get() { return m_opaque_up.get(); }
225 VariablesOptionsImpl &SBVariablesOptions::ref() { return *m_opaque_up; }
227 const VariablesOptionsImpl &SBVariablesOptions::ref() const {
228 return *m_opaque_up;
231 SBVariablesOptions::SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr)
232 : m_opaque_up(std::move(lldb_object_ptr)) {}
234 void SBVariablesOptions::SetOptions(VariablesOptionsImpl *lldb_object_ptr) {
235 m_opaque_up.reset(std::move(lldb_object_ptr));
238 namespace lldb_private {
239 namespace repro {
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));