1 //===-- SBExpressionOptions.cpp ---------------------------------------------*-
4 // The LLVM Compiler Infrastructure
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #include "lldb/API/SBExpressionOptions.h"
12 #include "lldb/API/SBStream.h"
14 #include "lldb/Target/Target.h"
17 using namespace lldb_private;
19 SBExpressionOptions::SBExpressionOptions()
20 : m_opaque_ap(new EvaluateExpressionOptions()) {}
22 SBExpressionOptions::SBExpressionOptions(const SBExpressionOptions &rhs) {
23 m_opaque_ap.reset(new EvaluateExpressionOptions());
24 *(m_opaque_ap.get()) = rhs.ref();
27 const SBExpressionOptions &SBExpressionOptions::
28 operator=(const SBExpressionOptions &rhs) {
30 this->ref() = rhs.ref();
35 SBExpressionOptions::~SBExpressionOptions() {}
37 bool SBExpressionOptions::GetCoerceResultToId() const {
38 return m_opaque_ap->DoesCoerceToId();
41 void SBExpressionOptions::SetCoerceResultToId(bool coerce) {
42 m_opaque_ap->SetCoerceToId(coerce);
45 bool SBExpressionOptions::GetUnwindOnError() const {
46 return m_opaque_ap->DoesUnwindOnError();
49 void SBExpressionOptions::SetUnwindOnError(bool unwind) {
50 m_opaque_ap->SetUnwindOnError(unwind);
53 bool SBExpressionOptions::GetIgnoreBreakpoints() const {
54 return m_opaque_ap->DoesIgnoreBreakpoints();
57 void SBExpressionOptions::SetIgnoreBreakpoints(bool ignore) {
58 m_opaque_ap->SetIgnoreBreakpoints(ignore);
61 lldb::DynamicValueType SBExpressionOptions::GetFetchDynamicValue() const {
62 return m_opaque_ap->GetUseDynamic();
65 void SBExpressionOptions::SetFetchDynamicValue(lldb::DynamicValueType dynamic) {
66 m_opaque_ap->SetUseDynamic(dynamic);
69 uint32_t SBExpressionOptions::GetTimeoutInMicroSeconds() const {
70 return m_opaque_ap->GetTimeout() ? m_opaque_ap->GetTimeout()->count() : 0;
73 void SBExpressionOptions::SetTimeoutInMicroSeconds(uint32_t timeout) {
74 m_opaque_ap->SetTimeout(timeout == 0 ? Timeout<std::micro>(llvm::None)
75 : std::chrono::microseconds(timeout));
78 uint32_t SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds() const {
79 return m_opaque_ap->GetOneThreadTimeout() ? m_opaque_ap->GetOneThreadTimeout()->count() : 0;
82 void SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds(uint32_t timeout) {
83 m_opaque_ap->SetOneThreadTimeout(timeout == 0
84 ? Timeout<std::micro>(llvm::None)
85 : std::chrono::microseconds(timeout));
88 bool SBExpressionOptions::GetTryAllThreads() const {
89 return m_opaque_ap->GetTryAllThreads();
92 void SBExpressionOptions::SetTryAllThreads(bool run_others) {
93 m_opaque_ap->SetTryAllThreads(run_others);
96 bool SBExpressionOptions::GetStopOthers() const {
97 return m_opaque_ap->GetStopOthers();
100 void SBExpressionOptions::SetStopOthers(bool run_others) {
101 m_opaque_ap->SetStopOthers(run_others);
104 bool SBExpressionOptions::GetTrapExceptions() const {
105 return m_opaque_ap->GetTrapExceptions();
108 void SBExpressionOptions::SetTrapExceptions(bool trap_exceptions) {
109 m_opaque_ap->SetTrapExceptions(trap_exceptions);
112 void SBExpressionOptions::SetLanguage(lldb::LanguageType language) {
113 m_opaque_ap->SetLanguage(language);
116 void SBExpressionOptions::SetCancelCallback(
117 lldb::ExpressionCancelCallback callback, void *baton) {
118 m_opaque_ap->SetCancelCallback(callback, baton);
121 bool SBExpressionOptions::GetGenerateDebugInfo() {
122 return m_opaque_ap->GetGenerateDebugInfo();
125 void SBExpressionOptions::SetGenerateDebugInfo(bool b) {
126 return m_opaque_ap->SetGenerateDebugInfo(b);
129 bool SBExpressionOptions::GetSuppressPersistentResult() {
130 return m_opaque_ap->GetResultIsInternal();
133 void SBExpressionOptions::SetSuppressPersistentResult(bool b) {
134 return m_opaque_ap->SetResultIsInternal(b);
137 const char *SBExpressionOptions::GetPrefix() const {
138 return m_opaque_ap->GetPrefix();
141 void SBExpressionOptions::SetPrefix(const char *prefix) {
142 return m_opaque_ap->SetPrefix(prefix);
145 bool SBExpressionOptions::GetAutoApplyFixIts() {
146 return m_opaque_ap->GetAutoApplyFixIts();
149 void SBExpressionOptions::SetAutoApplyFixIts(bool b) {
150 return m_opaque_ap->SetAutoApplyFixIts(b);
153 bool SBExpressionOptions::GetTopLevel() {
154 return m_opaque_ap->GetExecutionPolicy() == eExecutionPolicyTopLevel;
157 void SBExpressionOptions::SetTopLevel(bool b) {
158 m_opaque_ap->SetExecutionPolicy(b ? eExecutionPolicyTopLevel
159 : m_opaque_ap->default_execution_policy);
162 EvaluateExpressionOptions *SBExpressionOptions::get() const {
163 return m_opaque_ap.get();
166 EvaluateExpressionOptions &SBExpressionOptions::ref() const {
167 return *(m_opaque_ap.get());