]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBType.h
Fix a memory leak in if_delgroups() introduced in r334118.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / API / SBType.h
1 //===-- SBType.h ------------------------------------------------*- C++ -*-===//
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 #ifndef LLDB_SBType_h_
10 #define LLDB_SBType_h_
11
12 #include "lldb/API/SBDefines.h"
13
14 namespace lldb {
15
16 class SBTypeList;
17
18 class LLDB_API SBTypeMember {
19 public:
20   SBTypeMember();
21
22   SBTypeMember(const lldb::SBTypeMember &rhs);
23
24   ~SBTypeMember();
25
26   lldb::SBTypeMember &operator=(const lldb::SBTypeMember &rhs);
27
28   explicit operator bool() const;
29
30   bool IsValid() const;
31
32   const char *GetName();
33
34   lldb::SBType GetType();
35
36   uint64_t GetOffsetInBytes();
37
38   uint64_t GetOffsetInBits();
39
40   bool IsBitfield();
41
42   uint32_t GetBitfieldSizeInBits();
43
44   bool GetDescription(lldb::SBStream &description,
45                       lldb::DescriptionLevel description_level);
46
47 protected:
48   friend class SBType;
49
50   void reset(lldb_private::TypeMemberImpl *);
51
52   lldb_private::TypeMemberImpl &ref();
53
54   const lldb_private::TypeMemberImpl &ref() const;
55
56   std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_up;
57 };
58
59 class SBTypeMemberFunction {
60 public:
61   SBTypeMemberFunction();
62
63   SBTypeMemberFunction(const lldb::SBTypeMemberFunction &rhs);
64
65   ~SBTypeMemberFunction();
66
67   lldb::SBTypeMemberFunction &operator=(const lldb::SBTypeMemberFunction &rhs);
68
69   explicit operator bool() const;
70
71   bool IsValid() const;
72
73   const char *GetName();
74
75   const char *GetDemangledName();
76
77   const char *GetMangledName();
78
79   lldb::SBType GetType();
80
81   lldb::SBType GetReturnType();
82
83   uint32_t GetNumberOfArguments();
84
85   lldb::SBType GetArgumentTypeAtIndex(uint32_t);
86
87   lldb::MemberFunctionKind GetKind();
88
89   bool GetDescription(lldb::SBStream &description,
90                       lldb::DescriptionLevel description_level);
91
92 protected:
93   friend class SBType;
94
95   void reset(lldb_private::TypeMemberFunctionImpl *);
96
97   lldb_private::TypeMemberFunctionImpl &ref();
98
99   const lldb_private::TypeMemberFunctionImpl &ref() const;
100
101   lldb::TypeMemberFunctionImplSP m_opaque_sp;
102 };
103
104 class SBType {
105 public:
106   SBType();
107
108   SBType(const lldb::SBType &rhs);
109
110   ~SBType();
111
112   explicit operator bool() const;
113
114   bool IsValid() const;
115
116   uint64_t GetByteSize();
117
118   bool IsPointerType();
119
120   bool IsReferenceType();
121
122   bool IsFunctionType();
123
124   bool IsPolymorphicClass();
125
126   bool IsArrayType();
127
128   bool IsVectorType();
129
130   bool IsTypedefType();
131
132   bool IsAnonymousType();
133
134   lldb::SBType GetPointerType();
135
136   lldb::SBType GetPointeeType();
137
138   lldb::SBType GetReferenceType();
139
140   lldb::SBType GetTypedefedType();
141
142   lldb::SBType GetDereferencedType();
143
144   lldb::SBType GetUnqualifiedType();
145
146   lldb::SBType GetArrayElementType();
147
148   lldb::SBType GetArrayType(uint64_t size);
149
150   lldb::SBType GetVectorElementType();
151
152   lldb::SBType GetCanonicalType();
153   // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
154   // type eBasicTypeInvalid will be returned
155   lldb::BasicType GetBasicType();
156
157   // The call below confusing and should really be renamed to "CreateBasicType"
158   lldb::SBType GetBasicType(lldb::BasicType type);
159
160   uint32_t GetNumberOfFields();
161
162   uint32_t GetNumberOfDirectBaseClasses();
163
164   uint32_t GetNumberOfVirtualBaseClasses();
165
166   lldb::SBTypeMember GetFieldAtIndex(uint32_t idx);
167
168   lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx);
169
170   lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx);
171
172   lldb::SBTypeEnumMemberList GetEnumMembers();
173
174   uint32_t GetNumberOfTemplateArguments();
175
176   lldb::SBType GetTemplateArgumentType(uint32_t idx);
177
178   lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx);
179
180   lldb::SBType GetFunctionReturnType();
181
182   lldb::SBTypeList GetFunctionArgumentTypes();
183
184   uint32_t GetNumberOfMemberFunctions();
185
186   lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx);
187
188   const char *GetName();
189
190   const char *GetDisplayTypeName();
191
192   lldb::TypeClass GetTypeClass();
193
194   bool IsTypeComplete();
195
196   uint32_t GetTypeFlags();
197
198   bool GetDescription(lldb::SBStream &description,
199                       lldb::DescriptionLevel description_level);
200
201   lldb::SBType &operator=(const lldb::SBType &rhs);
202
203   bool operator==(lldb::SBType &rhs);
204
205   bool operator!=(lldb::SBType &rhs);
206
207 protected:
208   lldb_private::TypeImpl &ref();
209
210   const lldb_private::TypeImpl &ref() const;
211
212   lldb::TypeImplSP GetSP();
213
214   void SetSP(const lldb::TypeImplSP &type_impl_sp);
215
216   lldb::TypeImplSP m_opaque_sp;
217
218   friend class SBFunction;
219   friend class SBModule;
220   friend class SBTarget;
221   friend class SBTypeEnumMember;
222   friend class SBTypeEnumMemberList;
223   friend class SBTypeNameSpecifier;
224   friend class SBTypeMember;
225   friend class SBTypeMemberFunction;
226   friend class SBTypeList;
227   friend class SBValue;
228
229   SBType(const lldb_private::CompilerType &);
230   SBType(const lldb::TypeSP &);
231   SBType(const lldb::TypeImplSP &);
232 };
233
234 class SBTypeList {
235 public:
236   SBTypeList();
237
238   SBTypeList(const lldb::SBTypeList &rhs);
239
240   ~SBTypeList();
241
242   lldb::SBTypeList &operator=(const lldb::SBTypeList &rhs);
243
244   explicit operator bool() const;
245
246   bool IsValid();
247
248   void Append(lldb::SBType type);
249
250   lldb::SBType GetTypeAtIndex(uint32_t index);
251
252   uint32_t GetSize();
253
254 private:
255   std::unique_ptr<lldb_private::TypeListImpl> m_opaque_up;
256   friend class SBModule;
257   friend class SBCompileUnit;
258 };
259
260 } // namespace lldb
261
262 #endif // LLDB_SBType_h_