]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/API/SBVariablesOptions.cpp
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / API / SBVariablesOptions.cpp
1 //===-- SBVariablesOptions.cpp --------------------------------------*- C++
2 //-*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #include "lldb/API/SBVariablesOptions.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_ap(new VariablesOptionsImpl()) {}
85
86 SBVariablesOptions::SBVariablesOptions(const SBVariablesOptions &options)
87     : m_opaque_ap(new VariablesOptionsImpl(options.ref())) {}
88
89 SBVariablesOptions &SBVariablesOptions::
90 operator=(const SBVariablesOptions &options) {
91   m_opaque_ap.reset(new VariablesOptionsImpl(options.ref()));
92   return *this;
93 }
94
95 SBVariablesOptions::~SBVariablesOptions() = default;
96
97 bool SBVariablesOptions::IsValid() const { return m_opaque_ap != nullptr; }
98
99 bool SBVariablesOptions::GetIncludeArguments() const {
100   return m_opaque_ap->GetIncludeArguments();
101 }
102
103 void SBVariablesOptions::SetIncludeArguments(bool arguments) {
104   m_opaque_ap->SetIncludeArguments(arguments);
105 }
106
107 bool SBVariablesOptions::GetIncludeRecognizedArguments(
108     const lldb::SBTarget &target) const {
109   return m_opaque_ap->GetIncludeRecognizedArguments(target.GetSP());
110 }
111
112 void SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) {
113   m_opaque_ap->SetIncludeRecognizedArguments(arguments);
114 }
115
116 bool SBVariablesOptions::GetIncludeLocals() const {
117   return m_opaque_ap->GetIncludeLocals();
118 }
119
120 void SBVariablesOptions::SetIncludeLocals(bool locals) {
121   m_opaque_ap->SetIncludeLocals(locals);
122 }
123
124 bool SBVariablesOptions::GetIncludeStatics() const {
125   return m_opaque_ap->GetIncludeStatics();
126 }
127
128 void SBVariablesOptions::SetIncludeStatics(bool statics) {
129   m_opaque_ap->SetIncludeStatics(statics);
130 }
131
132 bool SBVariablesOptions::GetInScopeOnly() const {
133   return m_opaque_ap->GetInScopeOnly();
134 }
135
136 void SBVariablesOptions::SetInScopeOnly(bool in_scope_only) {
137   m_opaque_ap->SetInScopeOnly(in_scope_only);
138 }
139
140 bool SBVariablesOptions::GetIncludeRuntimeSupportValues() const {
141   return m_opaque_ap->GetIncludeRuntimeSupportValues();
142 }
143
144 void SBVariablesOptions::SetIncludeRuntimeSupportValues(
145     bool runtime_support_values) {
146   m_opaque_ap->SetIncludeRuntimeSupportValues(runtime_support_values);
147 }
148
149 lldb::DynamicValueType SBVariablesOptions::GetUseDynamic() const {
150   return m_opaque_ap->GetUseDynamic();
151 }
152
153 void SBVariablesOptions::SetUseDynamic(lldb::DynamicValueType dynamic) {
154   m_opaque_ap->SetUseDynamic(dynamic);
155 }
156
157 VariablesOptionsImpl *SBVariablesOptions::operator->() {
158   return m_opaque_ap.operator->();
159 }
160
161 const VariablesOptionsImpl *SBVariablesOptions::operator->() const {
162   return m_opaque_ap.operator->();
163 }
164
165 VariablesOptionsImpl *SBVariablesOptions::get() { return m_opaque_ap.get(); }
166
167 VariablesOptionsImpl &SBVariablesOptions::ref() { return *m_opaque_ap; }
168
169 const VariablesOptionsImpl &SBVariablesOptions::ref() const {
170   return *m_opaque_ap;
171 }
172
173 SBVariablesOptions::SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr)
174     : m_opaque_ap(std::move(lldb_object_ptr)) {}
175
176 void SBVariablesOptions::SetOptions(VariablesOptionsImpl *lldb_object_ptr) {
177   m_opaque_ap.reset(std::move(lldb_object_ptr));
178 }