1 //===-- SBCommandInterpreterRunOptions.cpp --------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "lldb/lldb-types.h"
10 
11 #include "lldb/Utility/ReproducerInstrumentation.h"
12 
13 #include "lldb/API/SBCommandInterpreterRunOptions.h"
14 #include "lldb/Interpreter/CommandInterpreter.h"
15 
16 #include <memory>
17 
18 using namespace lldb;
19 using namespace lldb_private;
20 
21 SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions() {
22   LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommandInterpreterRunOptions);
23 
24   m_opaque_up = std::make_unique<CommandInterpreterRunOptions>();
25 }
26 
27 SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions(
28     const SBCommandInterpreterRunOptions &rhs) {
29   LLDB_RECORD_CONSTRUCTOR(SBCommandInterpreterRunOptions,
30                           (const lldb::SBCommandInterpreterRunOptions &), rhs);
31 
32   m_opaque_up = std::make_unique<CommandInterpreterRunOptions>(rhs.ref());
33 }
34 
35 SBCommandInterpreterRunOptions::~SBCommandInterpreterRunOptions() = default;
36 
37 SBCommandInterpreterRunOptions &SBCommandInterpreterRunOptions::operator=(
38     const SBCommandInterpreterRunOptions &rhs) {
39   LLDB_RECORD_METHOD(lldb::SBCommandInterpreterRunOptions &,
40                      SBCommandInterpreterRunOptions, operator=,
41                      (const lldb::SBCommandInterpreterRunOptions &), rhs);
42 
43   if (this == &rhs)
44     return *this;
45   *m_opaque_up = *rhs.m_opaque_up;
46   return *this;
47 }
48 
49 bool SBCommandInterpreterRunOptions::GetStopOnContinue() const {
50   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
51                                    GetStopOnContinue);
52 
53   return m_opaque_up->GetStopOnContinue();
54 }
55 
56 void SBCommandInterpreterRunOptions::SetStopOnContinue(bool stop_on_continue) {
57   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue,
58                      (bool), stop_on_continue);
59 
60   m_opaque_up->SetStopOnContinue(stop_on_continue);
61 }
62 
63 bool SBCommandInterpreterRunOptions::GetStopOnError() const {
64   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
65                                    GetStopOnError);
66 
67   return m_opaque_up->GetStopOnError();
68 }
69 
70 void SBCommandInterpreterRunOptions::SetStopOnError(bool stop_on_error) {
71   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnError,
72                      (bool), stop_on_error);
73 
74   m_opaque_up->SetStopOnError(stop_on_error);
75 }
76 
77 bool SBCommandInterpreterRunOptions::GetStopOnCrash() const {
78   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
79                                    GetStopOnCrash);
80 
81   return m_opaque_up->GetStopOnCrash();
82 }
83 
84 void SBCommandInterpreterRunOptions::SetStopOnCrash(bool stop_on_crash) {
85   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnCrash,
86                      (bool), stop_on_crash);
87 
88   m_opaque_up->SetStopOnCrash(stop_on_crash);
89 }
90 
91 bool SBCommandInterpreterRunOptions::GetEchoCommands() const {
92   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
93                                    GetEchoCommands);
94 
95   return m_opaque_up->GetEchoCommands();
96 }
97 
98 void SBCommandInterpreterRunOptions::SetEchoCommands(bool echo_commands) {
99   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetEchoCommands,
100                      (bool), echo_commands);
101 
102   m_opaque_up->SetEchoCommands(echo_commands);
103 }
104 
105 bool SBCommandInterpreterRunOptions::GetEchoCommentCommands() const {
106   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
107                                    GetEchoCommentCommands);
108 
109   return m_opaque_up->GetEchoCommentCommands();
110 }
111 
112 void SBCommandInterpreterRunOptions::SetEchoCommentCommands(bool echo) {
113   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions,
114                      SetEchoCommentCommands, (bool), echo);
115 
116   m_opaque_up->SetEchoCommentCommands(echo);
117 }
118 
119 bool SBCommandInterpreterRunOptions::GetPrintResults() const {
120   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
121                                    GetPrintResults);
122 
123   return m_opaque_up->GetPrintResults();
124 }
125 
126 void SBCommandInterpreterRunOptions::SetPrintResults(bool print_results) {
127   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults,
128                      (bool), print_results);
129 
130   m_opaque_up->SetPrintResults(print_results);
131 }
132 
133 bool SBCommandInterpreterRunOptions::GetPrintErrors() const {
134   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
135                                    GetPrintErrors);
136 
137   return m_opaque_up->GetPrintErrors();
138 }
139 
140 void SBCommandInterpreterRunOptions::SetPrintErrors(bool print_errors) {
141   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetPrintErrors,
142                      (bool), print_errors);
143 
144   m_opaque_up->SetPrintErrors(print_errors);
145 }
146 
147 bool SBCommandInterpreterRunOptions::GetAddToHistory() const {
148   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
149                                    GetAddToHistory);
150 
151   return m_opaque_up->GetAddToHistory();
152 }
153 
154 void SBCommandInterpreterRunOptions::SetAddToHistory(bool add_to_history) {
155   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory,
156                      (bool), add_to_history);
157 
158   m_opaque_up->SetAddToHistory(add_to_history);
159 }
160 
161 bool SBCommandInterpreterRunOptions::GetAutoHandleEvents() const {
162   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
163                                    GetAutoHandleEvents);
164 
165   return m_opaque_up->GetAutoHandleEvents();
166 }
167 
168 void SBCommandInterpreterRunOptions::SetAutoHandleEvents(
169     bool auto_handle_events) {
170   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAutoHandleEvents,
171                      (bool), auto_handle_events);
172 
173   m_opaque_up->SetAutoHandleEvents(auto_handle_events);
174 }
175 
176 bool SBCommandInterpreterRunOptions::GetSpawnThread() const {
177   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
178                                    GetSpawnThread);
179 
180   return m_opaque_up->GetSpawnThread();
181 }
182 
183 void SBCommandInterpreterRunOptions::SetSpawnThread(bool spawn_thread) {
184   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread,
185                      (bool), spawn_thread);
186 
187   m_opaque_up->SetSpawnThread(spawn_thread);
188 }
189 
190 lldb_private::CommandInterpreterRunOptions *
191 SBCommandInterpreterRunOptions::get() const {
192   return m_opaque_up.get();
193 }
194 
195 lldb_private::CommandInterpreterRunOptions &
196 SBCommandInterpreterRunOptions::ref() const {
197   return *m_opaque_up;
198 }
199 
200 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult()
201     : m_opaque_up(new CommandInterpreterRunResult())
202 
203 {
204   LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommandInterpreterRunResult);
205 }
206 
207 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
208     const SBCommandInterpreterRunResult &rhs)
209     : m_opaque_up(new CommandInterpreterRunResult()) {
210   LLDB_RECORD_CONSTRUCTOR(SBCommandInterpreterRunResult,
211                           (const lldb::SBCommandInterpreterRunResult &), rhs);
212 
213   *m_opaque_up = *rhs.m_opaque_up;
214 }
215 
216 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
217     const CommandInterpreterRunResult &rhs) {
218   m_opaque_up = std::make_unique<CommandInterpreterRunResult>(rhs);
219 }
220 
221 SBCommandInterpreterRunResult::~SBCommandInterpreterRunResult() = default;
222 
223 SBCommandInterpreterRunResult &SBCommandInterpreterRunResult::operator=(
224     const SBCommandInterpreterRunResult &rhs) {
225   LLDB_RECORD_METHOD(lldb::SBCommandInterpreterRunResult &,
226                      SBCommandInterpreterRunResult, operator=,
227                      (const lldb::SBCommandInterpreterRunResult &), rhs);
228 
229   if (this == &rhs)
230     return *this;
231   *m_opaque_up = *rhs.m_opaque_up;
232   return *this;
233 }
234 
235 int SBCommandInterpreterRunResult::GetNumberOfErrors() const {
236   LLDB_RECORD_METHOD_CONST_NO_ARGS(int, SBCommandInterpreterRunResult,
237                                    GetNumberOfErrors);
238 
239   return m_opaque_up->GetNumErrors();
240 }
241 
242 lldb::CommandInterpreterResult
243 SBCommandInterpreterRunResult::GetResult() const {
244   LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::CommandInterpreterResult,
245                                    SBCommandInterpreterRunResult, GetResult);
246 
247   return m_opaque_up->GetResult();
248 }
249