1 //===-- SBCommandInterpreterRunOptions.cpp --------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "lldb/lldb-types.h"
11 #include "SBReproducerPrivate.h"
13 #include "lldb/API/SBCommandInterpreterRunOptions.h"
14 #include "lldb/Interpreter/CommandInterpreter.h"
19 using namespace lldb_private;
21 SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions() {
22 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommandInterpreterRunOptions);
24 m_opaque_up = std::make_unique<CommandInterpreterRunOptions>();
27 SBCommandInterpreterRunOptions::~SBCommandInterpreterRunOptions() = default;
29 bool SBCommandInterpreterRunOptions::GetStopOnContinue() const {
30 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
33 return m_opaque_up->GetStopOnContinue();
36 void SBCommandInterpreterRunOptions::SetStopOnContinue(bool stop_on_continue) {
37 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue,
38 (bool), stop_on_continue);
40 m_opaque_up->SetStopOnContinue(stop_on_continue);
43 bool SBCommandInterpreterRunOptions::GetStopOnError() const {
44 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
47 return m_opaque_up->GetStopOnError();
50 void SBCommandInterpreterRunOptions::SetStopOnError(bool stop_on_error) {
51 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnError,
52 (bool), stop_on_error);
54 m_opaque_up->SetStopOnError(stop_on_error);
57 bool SBCommandInterpreterRunOptions::GetStopOnCrash() const {
58 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
61 return m_opaque_up->GetStopOnCrash();
64 void SBCommandInterpreterRunOptions::SetStopOnCrash(bool stop_on_crash) {
65 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnCrash,
66 (bool), stop_on_crash);
68 m_opaque_up->SetStopOnCrash(stop_on_crash);
71 bool SBCommandInterpreterRunOptions::GetEchoCommands() const {
72 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
75 return m_opaque_up->GetEchoCommands();
78 void SBCommandInterpreterRunOptions::SetEchoCommands(bool echo_commands) {
79 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetEchoCommands,
80 (bool), echo_commands);
82 m_opaque_up->SetEchoCommands(echo_commands);
85 bool SBCommandInterpreterRunOptions::GetEchoCommentCommands() const {
86 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
87 GetEchoCommentCommands);
89 return m_opaque_up->GetEchoCommentCommands();
92 void SBCommandInterpreterRunOptions::SetEchoCommentCommands(bool echo) {
93 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions,
94 SetEchoCommentCommands, (bool), echo);
96 m_opaque_up->SetEchoCommentCommands(echo);
99 bool SBCommandInterpreterRunOptions::GetPrintResults() const {
100 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
103 return m_opaque_up->GetPrintResults();
106 void SBCommandInterpreterRunOptions::SetPrintResults(bool print_results) {
107 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults,
108 (bool), print_results);
110 m_opaque_up->SetPrintResults(print_results);
113 bool SBCommandInterpreterRunOptions::GetAddToHistory() const {
114 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
117 return m_opaque_up->GetAddToHistory();
120 void SBCommandInterpreterRunOptions::SetAddToHistory(bool add_to_history) {
121 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory,
122 (bool), add_to_history);
124 m_opaque_up->SetAddToHistory(add_to_history);
127 bool SBCommandInterpreterRunOptions::GetAutoHandleEvents() const {
128 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
129 GetAutoHandleEvents);
131 return m_opaque_up->GetAutoHandleEvents();
134 void SBCommandInterpreterRunOptions::SetAutoHandleEvents(
135 bool auto_handle_events) {
136 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAutoHandleEvents,
137 (bool), auto_handle_events);
139 m_opaque_up->SetAutoHandleEvents(auto_handle_events);
142 bool SBCommandInterpreterRunOptions::GetSpawnThread() const {
143 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
146 return m_opaque_up->GetSpawnThread();
149 void SBCommandInterpreterRunOptions::SetSpawnThread(bool spawn_thread) {
150 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread,
151 (bool), spawn_thread);
153 m_opaque_up->SetSpawnThread(spawn_thread);
156 lldb_private::CommandInterpreterRunOptions *
157 SBCommandInterpreterRunOptions::get() const {
158 return m_opaque_up.get();
161 lldb_private::CommandInterpreterRunOptions &
162 SBCommandInterpreterRunOptions::ref() const {
166 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult()
167 : m_opaque_up(new CommandInterpreterRunResult())
170 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommandInterpreterRunResult);
173 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
174 const SBCommandInterpreterRunResult &rhs)
175 : m_opaque_up(new CommandInterpreterRunResult()) {
176 LLDB_RECORD_CONSTRUCTOR(SBCommandInterpreterRunResult,
177 (const lldb::SBCommandInterpreterRunResult &), rhs);
179 *m_opaque_up = *rhs.m_opaque_up;
182 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
183 const CommandInterpreterRunResult &rhs)
185 m_opaque_up = std::make_unique<CommandInterpreterRunResult>(rhs);
188 SBCommandInterpreterRunResult::~SBCommandInterpreterRunResult() = default;
190 SBCommandInterpreterRunResult &SBCommandInterpreterRunResult::operator=(
191 const SBCommandInterpreterRunResult &rhs) {
192 LLDB_RECORD_METHOD(lldb::SBCommandInterpreterRunResult &,
193 SBCommandInterpreterRunResult,
194 operator=,(const lldb::SBCommandInterpreterRunResult &),
199 *m_opaque_up = *rhs.m_opaque_up;
200 return LLDB_RECORD_RESULT(*this);
203 int SBCommandInterpreterRunResult::GetNumberOfErrors() const {
204 LLDB_RECORD_METHOD_CONST_NO_ARGS(int, SBCommandInterpreterRunResult,
207 return m_opaque_up->GetNumErrors();
210 lldb::CommandInterpreterResult
211 SBCommandInterpreterRunResult::GetResult() const {
212 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::CommandInterpreterResult,
213 SBCommandInterpreterRunResult, GetResult);
215 return m_opaque_up->GetResult();
218 namespace lldb_private {
221 template <> void RegisterMethods<SBCommandInterpreterRunOptions>(Registry &R) {
222 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunOptions, ());
223 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
224 GetStopOnContinue, ());
225 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue,
227 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
229 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnError,
231 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
233 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnCrash,
235 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
236 GetEchoCommands, ());
237 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetEchoCommands,
239 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
240 GetEchoCommentCommands, ());
241 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions,
242 SetEchoCommentCommands, (bool));
243 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
244 GetPrintResults, ());
245 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults,
247 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
248 GetAddToHistory, ());
249 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory,
251 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
252 GetAutoHandleEvents, ());
253 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions,
254 SetAutoHandleEvents, (bool));
255 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
257 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread,
259 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunResult, ());
260 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunResult,
261 (const lldb::SBCommandInterpreterRunResult &));
262 LLDB_REGISTER_METHOD(lldb::SBCommandInterpreterRunResult &,
263 SBCommandInterpreterRunResult,
264 operator=,(const lldb::SBCommandInterpreterRunResult &));
265 LLDB_REGISTER_METHOD_CONST(int, SBCommandInterpreterRunResult,
266 GetNumberOfErrors, ());
267 LLDB_REGISTER_METHOD_CONST(lldb::CommandInterpreterResult,
268 SBCommandInterpreterRunResult, GetResult, ());
272 } // namespace lldb_private