LLDB mainline
SBTypeFilter.cpp
Go to the documentation of this file.
1//===-- SBTypeFilter.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
11
12#include "lldb/API/SBStream.h"
13
15
16using namespace lldb;
17using namespace lldb_private;
18
20
22 : m_opaque_sp(TypeFilterImplSP(new TypeFilterImpl(options))) {
23 LLDB_INSTRUMENT_VA(this, options);
24}
25
27 : m_opaque_sp(rhs.m_opaque_sp) {
28 LLDB_INSTRUMENT_VA(this, rhs);
29}
30
32
35 return this->operator bool();
36}
37SBTypeFilter::operator bool() const {
39
40 return m_opaque_sp.get() != nullptr;
41}
42
45
46 if (IsValid())
47 return m_opaque_sp->GetOptions();
48 return 0;
49}
50
51void SBTypeFilter::SetOptions(uint32_t value) {
52 LLDB_INSTRUMENT_VA(this, value);
53
54 if (CopyOnWrite_Impl())
55 m_opaque_sp->SetOptions(value);
56}
57
59 lldb::DescriptionLevel description_level) {
60 LLDB_INSTRUMENT_VA(this, description, description_level);
61
62 if (!IsValid())
63 return false;
64 else {
65 description.Printf("%s\n", m_opaque_sp->GetDescription().c_str());
66 return true;
67 }
68}
69
72
73 if (CopyOnWrite_Impl())
74 m_opaque_sp->Clear();
75}
76
79
80 if (IsValid())
81 return m_opaque_sp->GetCount();
82 return 0;
83}
84
86 LLDB_INSTRUMENT_VA(this, i);
87
88 if (!IsValid())
89 return nullptr;
90
91 const char *item = m_opaque_sp->GetExpressionPathAtIndex(i);
92 if (item && *item == '.')
93 item++;
94 return ConstString(item).GetCString();
95}
96
97bool SBTypeFilter::ReplaceExpressionPathAtIndex(uint32_t i, const char *item) {
98 LLDB_INSTRUMENT_VA(this, i, item);
99
100 if (CopyOnWrite_Impl())
101 return m_opaque_sp->SetExpressionPathAtIndex(i, item);
102 else
103 return false;
104}
105
107 LLDB_INSTRUMENT_VA(this, item);
108
109 if (CopyOnWrite_Impl())
110 m_opaque_sp->AddExpressionPath(item);
111}
112
114 LLDB_INSTRUMENT_VA(this, rhs);
115
116 if (this != &rhs) {
118 }
119 return *this;
120}
121
123 LLDB_INSTRUMENT_VA(this, rhs);
124
125 if (!IsValid())
126 return !rhs.IsValid();
127
128 return m_opaque_sp == rhs.m_opaque_sp;
129}
130
132 LLDB_INSTRUMENT_VA(this, rhs);
133
134 if (!IsValid())
135 return !rhs.IsValid();
136
138 return false;
139
140 for (uint32_t j = 0; j < GetNumberOfExpressionPaths(); j++)
141 if (strcmp(GetExpressionPathAtIndex(j), rhs.GetExpressionPathAtIndex(j)) !=
142 0)
143 return false;
144
145 return GetOptions() == rhs.GetOptions();
146}
147
149 LLDB_INSTRUMENT_VA(this, rhs);
150
151 if (!IsValid())
152 return !rhs.IsValid();
153
154 return m_opaque_sp != rhs.m_opaque_sp;
155}
156
158
159void SBTypeFilter::SetSP(const lldb::TypeFilterImplSP &typefilter_impl_sp) {
160 m_opaque_sp = typefilter_impl_sp;
161}
162
164 : m_opaque_sp(typefilter_impl_sp) {}
165
167 if (!IsValid())
168 return false;
169 if (m_opaque_sp.use_count() == 1)
170 return true;
171
173
174 for (uint32_t j = 0; j < GetNumberOfExpressionPaths(); j++)
175 new_sp->AddExpressionPath(GetExpressionPathAtIndex(j));
176
177 SetSP(new_sp);
178
179 return true;
180}
#define LLDB_INSTRUMENT_VA(...)
lldb::TypeFilterImplSP m_opaque_sp
Definition: SBTypeFilter.h:65
bool operator!=(lldb::SBTypeFilter &rhs)
uint32_t GetNumberOfExpressionPaths()
const char * GetExpressionPathAtIndex(uint32_t i)
void SetSP(const lldb::TypeFilterImplSP &typefilter_impl_sp)
bool IsValid() const
bool operator==(lldb::SBTypeFilter &rhs)
void AppendExpressionPath(const char *item)
lldb::TypeFilterImplSP GetSP()
bool ReplaceExpressionPathAtIndex(uint32_t i, const char *item)
void SetOptions(uint32_t)
lldb::SBTypeFilter & operator=(const lldb::SBTypeFilter &rhs)
bool IsEqualTo(lldb::SBTypeFilter &rhs)
uint32_t GetOptions()
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
A uniqued constant string class.
Definition: ConstString.h:40
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::shared_ptr< lldb_private::TypeFilterImpl > TypeFilterImplSP
Definition: lldb-forward.h:463