LLDB  mainline
SBType.h
Go to the documentation of this file.
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_API_SBTYPE_H
10 #define LLDB_API_SBTYPE_H
11 
12 #include "lldb/API/SBDefines.h"
13 
14 namespace lldb {
15 
16 class SBTypeList;
17 
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 
53 
54  const lldb_private::TypeMemberImpl &ref() const;
55 
56  std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_up;
57 };
58 
60 public:
62 
64 
66 
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 
80 
82 
84 
86 
88 
89  bool GetDescription(lldb::SBStream &description,
90  lldb::DescriptionLevel description_level);
91 
92 protected:
93  friend class SBType;
94 
96 
98 
100 
101  lldb::TypeMemberFunctionImplSP m_opaque_sp;
102 };
103 
104 class SBType {
105 public:
106  SBType();
107 
108  SBType(const lldb::SBType &rhs);
109  SBType(const lldb::TypeImplSP &);
110 
111  ~SBType();
112 
113  explicit operator bool() const;
114 
115  bool IsValid() const;
116 
117  uint64_t GetByteSize();
118 
119  bool IsPointerType();
120 
121  bool IsReferenceType();
122 
123  bool IsFunctionType();
124 
125  bool IsPolymorphicClass();
126 
127  bool IsArrayType();
128 
129  bool IsVectorType();
130 
131  bool IsTypedefType();
132 
133  bool IsAnonymousType();
134 
136 
137  bool IsAggregateType();
138 
140 
142 
144 
146 
148 
150 
152 
153  lldb::SBType GetArrayType(uint64_t size);
154 
156 
158 
160 
161  // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
162  // type eBasicTypeInvalid will be returned
164 
165  // The call below confusing and should really be renamed to "CreateBasicType"
167 
169 
171 
173 
175 
177 
179 
181 
183 
185 
186  /// Return the TemplateArgumentKind of the template argument at index idx.
187  /// Variadic argument packs are automatically expanded.
189 
191 
193 
195 
197 
199 
200  const char *GetName();
201 
202  const char *GetDisplayTypeName();
203 
204  lldb::TypeClass GetTypeClass();
205 
206  bool IsTypeComplete();
207 
209 
210  bool GetDescription(lldb::SBStream &description,
211  lldb::DescriptionLevel description_level);
212 
213  lldb::SBType &operator=(const lldb::SBType &rhs);
214 
215  bool operator==(lldb::SBType &rhs);
216 
217  bool operator!=(lldb::SBType &rhs);
218 
219 protected:
221 
222  const lldb_private::TypeImpl &ref() const;
223 
224  lldb::TypeImplSP GetSP();
225 
226  void SetSP(const lldb::TypeImplSP &type_impl_sp);
227 
228  lldb::TypeImplSP m_opaque_sp;
229 
230  friend class SBFunction;
231  friend class SBModule;
232  friend class SBTarget;
233  friend class SBTypeEnumMember;
234  friend class SBTypeEnumMemberList;
235  friend class SBTypeNameSpecifier;
236  friend class SBTypeMember;
237  friend class SBTypeMemberFunction;
238  friend class SBTypeList;
239  friend class SBValue;
240 
242  SBType(const lldb::TypeSP &);
243 };
244 
245 class SBTypeList {
246 public:
247  SBTypeList();
248 
249  SBTypeList(const lldb::SBTypeList &rhs);
250 
251  ~SBTypeList();
252 
254 
255  explicit operator bool() const;
256 
257  bool IsValid();
258 
259  void Append(lldb::SBType type);
260 
262 
263  uint32_t GetSize();
264 
265 private:
266  std::unique_ptr<lldb_private::TypeListImpl> m_opaque_up;
267  friend class SBModule;
268  friend class SBCompileUnit;
269 };
270 
271 } // namespace lldb
272 
273 #endif // LLDB_API_SBTYPE_H
lldb::SBTypeMemberFunction::GetType
lldb::SBType GetType()
Definition: SBType.cpp:829
lldb::SBType::GetTemplateArgumentKind
lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx)
Return the TemplateArgumentKind of the template argument at index idx.
Definition: SBType.cpp:579
lldb::SBTypeList::GetTypeAtIndex
lldb::SBType GetTypeAtIndex(uint32_t index)
Definition: SBType.cpp:630
lldb::SBTypeMemberFunction::GetNumberOfArguments
uint32_t GetNumberOfArguments()
Definition: SBType.cpp:849
lldb_private::TypeMemberImpl
Definition: Type.h:348
lldb::SBTypeMemberFunction::operator=
lldb::SBTypeMemberFunction & operator=(const lldb::SBTypeMemberFunction &rhs)
Definition: SBType.cpp:782
lldb::SBTypeNameSpecifier
Definition: SBTypeNameSpecifier.h:17
lldb::SBTypeList::operator=
lldb::SBTypeList & operator=(const lldb::SBTypeList &rhs)
Definition: SBType.cpp:611
lldb::SBType::GetReferenceType
lldb::SBType GetReferenceType()
Definition: SBType.cpp:179
lldb::SBType::GetFieldAtIndex
lldb::SBTypeMember GetFieldAtIndex(uint32_t idx)
Definition: SBType.cpp:462
lldb::SBType::IsVectorType
bool IsVectorType()
Definition: SBType.cpp:146
SBDefines.h
lldb::SBType::operator==
bool operator==(lldb::SBType &rhs)
Definition: SBType.cpp:51
lldb::SBTypeEnumMemberList
Definition: SBTypeEnumMember.h:57
lldb::SBType::m_opaque_sp
lldb::TypeImplSP m_opaque_sp
Definition: SBType.h:228
lldb::SBCompileUnit
Definition: SBCompileUnit.h:17
lldb::SBType::operator=
lldb::SBType & operator=(const lldb::SBType &rhs)
Definition: SBType.cpp:81
lldb::SBType::GetNumberOfDirectBaseClasses
uint32_t GetNumberOfDirectBaseClasses()
Definition: SBType.cpp:370
lldb::SBType::GetMemberFunctionAtIndex
lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx)
Definition: SBType.cpp:317
lldb::SBType::GetVirtualBaseClassAtIndex
lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx)
Definition: SBType.cpp:424
lldb::SBValue
Definition: SBValue.h:21
lldb::SBTypeMember::m_opaque_up
std::unique_ptr< lldb_private::TypeMemberImpl > m_opaque_up
Definition: SBType.h:56
lldb::SBType::IsArrayType
bool IsArrayType()
Definition: SBType.cpp:137
lldb::SBTypeList::SBTypeList
SBTypeList()
Definition: SBType.cpp:588
lldb::SBType::IsTypeComplete
bool IsTypeComplete()
Definition: SBType.cpp:488
lldb::SBType::GetArrayType
lldb::SBType GetArrayType(uint64_t size)
Definition: SBType.cpp:212
lldb::SBTypeMemberFunction
Definition: SBType.h:59
lldb::BasicType
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Definition: lldb-enumerations.h:748
lldb::SBType::GetNumberOfTemplateArguments
uint32_t GetNumberOfTemplateArguments()
Definition: SBType.cpp:544
lldb::SBType::GetNumberOfMemberFunctions
uint32_t GetNumberOfMemberFunctions()
Definition: SBType.cpp:308
lldb::SBTypeMemberFunction::GetArgumentTypeAtIndex
lldb::SBType GetArgumentTypeAtIndex(uint32_t)
Definition: SBType.cpp:857
lldb::SBType::IsAggregateType
bool IsAggregateType()
Definition: SBType.cpp:274
lldb::SBTypeMemberFunction::GetReturnType
lldb::SBType GetReturnType()
Definition: SBType.cpp:839
lldb::SBType::GetTemplateArgumentType
lldb::SBType GetTemplateArgumentType(uint32_t idx)
Definition: SBType.cpp:553
lldb::SBType::GetDereferencedType
lldb::SBType GetDereferencedType()
Definition: SBType.cpp:195
lldb::SBTarget
Definition: SBTarget.h:29
lldb::SBType::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBType.cpp:394
lldb::SBTypeMemberFunction::SBTypeMemberFunction
SBTypeMemberFunction()
Definition: SBType.cpp:772
lldb::SBType::GetPointeeType
lldb::SBType GetPointeeType()
Definition: SBType.cpp:171
GetName
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition: XcodeSDK.cpp:21
lldb::SBType::GetTypeClass
lldb::TypeClass GetTypeClass()
Definition: SBType.cpp:536
lldb::SBType::GetUnqualifiedType
lldb::SBType GetUnqualifiedType()
Definition: SBType.cpp:327
lldb::SBType::GetModule
lldb::SBModule GetModule()
Definition: SBType.cpp:509
lldb::SBType::IsAnonymousType
bool IsAnonymousType()
Definition: SBType.cpp:258
lldb::SBFunction
Definition: SBFunction.h:18
lldb::SBTypeList
class LLDB_API SBTypeList
Definition: SBDefines.h:103
lldb::SBType::GetFunctionArgumentTypes
lldb::SBTypeList GetFunctionArgumentTypes()
Definition: SBType.cpp:294
lldb::SBTypeList::IsValid
bool IsValid()
Definition: SBType.cpp:601
lldb::SBType::GetDisplayTypeName
const char * GetDisplayTypeName()
Definition: SBType.cpp:528
lldb::SBType::GetNumberOfFields
uint32_t GetNumberOfFields()
Definition: SBType.cpp:386
lldb::SBType::operator!=
bool operator!=(lldb::SBType &rhs)
Definition: SBType.cpp:63
lldb::TemplateArgumentKind
TemplateArgumentKind
Definition: lldb-enumerations.h:822
lldb::SBTypeList::m_opaque_up
std::unique_ptr< lldb_private::TypeListImpl > m_opaque_up
Definition: SBType.h:266
lldb::SBType
Definition: SBType.h:104
lldb::SBType::ref
lldb_private::TypeImpl & ref()
Definition: SBType.cpp:92
lldb::SBTypeList::GetSize
uint32_t GetSize()
Definition: SBType.cpp:638
lldb::SBType::IsFunctionType
bool IsFunctionType()
Definition: SBType.cpp:234
lldb::SBTypeList
Definition: SBType.h:245
lldb::SBTypeMemberFunction::GetName
const char * GetName()
Definition: SBType.cpp:800
lldb::SBTypeMemberFunction::ref
lldb_private::TypeMemberFunctionImpl & ref()
Definition: SBType.cpp:892
lldb::SBType::IsPointerType
bool IsPointerType()
Definition: SBType.cpp:129
lldb::SBType::GetFunctionReturnType
lldb::SBType GetFunctionReturnType()
Definition: SBType.cpp:282
lldb::SBType::GetTypeFlags
uint32_t GetTypeFlags()
Definition: SBType.cpp:501
lldb::SBType::IsPolymorphicClass
bool IsPolymorphicClass()
Definition: SBType.cpp:242
uint32_t
lldb::SBTypeMemberFunction::IsValid
bool IsValid() const
Definition: SBType.cpp:790
lldb::SBType::SBType
SBType()
Definition: SBType.cpp:29
lldb::SBTypeMemberFunction::reset
void reset(lldb_private::TypeMemberFunctionImpl *)
Definition: SBType.cpp:888
lldb::SBType::GetPointerType
lldb::SBType GetPointerType()
Definition: SBType.cpp:162
lldb::SBModule
Definition: SBModule.h:20
lldb::SBTypeMemberFunction::~SBTypeMemberFunction
~SBTypeMemberFunction()
lldb::SBType::IsTypedefType
bool IsTypedefType()
Definition: SBType.cpp:250
lldb::SBType::GetSP
lldb::TypeImplSP GetSP()
Definition: SBType.cpp:75
lldb::SBTypeMember
Definition: SBType.h:18
lldb::SBTypeMemberFunction::GetKind
lldb::MemberFunctionKind GetKind()
Definition: SBType.cpp:868
lldb::SBType::IsScopedEnumerationType
bool IsScopedEnumerationType()
Definition: SBType.cpp:266
lldb::SBType::GetNumberOfVirtualBaseClasses
uint32_t GetNumberOfVirtualBaseClasses()
Definition: SBType.cpp:378
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:35
lldb::SBType::GetTypedefedType
lldb::SBType GetTypedefedType()
Definition: SBType.cpp:187
lldb::SBType::GetName
const char * GetName()
Definition: SBType.cpp:520
lldb_private::TypeImpl
Definition: Type.h:246
lldb::SBType::GetEnumerationIntegerType
lldb::SBType GetEnumerationIntegerType()
Definition: SBType.cpp:343
lldb::SBTypeList::~SBTypeList
~SBTypeList()
lldb::SBType::GetCanonicalType
lldb::SBType GetCanonicalType()
Definition: SBType.cpp:335
lldb::SBType::GetBasicType
lldb::BasicType GetBasicType()
Definition: SBType.cpp:353
lldb::SBType::GetArrayElementType
lldb::SBType GetArrayElementType()
Definition: SBType.cpp:203
lldb::MemberFunctionKind
MemberFunctionKind
Kind of member function.
Definition: lldb-enumerations.h:1048
lldb::SBTypeList::Append
void Append(lldb::SBType type)
Definition: SBType.cpp:623
lldb::SBTypeMemberFunction::GetMangledName
const char * GetMangledName()
Definition: SBType.cpp:821
lldb::SBType::IsValid
bool IsValid() const
Definition: SBType.cpp:106
lldb::SBType::GetEnumMembers
lldb::SBTypeEnumMemberList GetEnumMembers()
Definition: SBType.cpp:440
lldb::SBStream
Definition: SBStream.h:18
lldb::SBType::GetDirectBaseClassAtIndex
lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx)
Definition: SBType.cpp:408
lldb_private::TypeMemberFunctionImpl
Definition: Type.h:440
lldb::SBType::GetVectorElementType
lldb::SBType GetVectorElementType()
Definition: SBType.cpp:221
lldb::SBType::GetByteSize
uint64_t GetByteSize()
Definition: SBType.cpp:119
lldb::SBType::IsReferenceType
bool IsReferenceType()
Definition: SBType.cpp:154
lldb::SBTypeMemberFunction::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBType.cpp:876
lldb::SBTypeMemberFunction::m_opaque_sp
lldb::TypeMemberFunctionImplSP m_opaque_sp
Definition: SBType.h:101
lldb
Definition: SBAddress.h:15
lldb::SBType::SetSP
void SetSP(const lldb::TypeImplSP &type_impl_sp)
Definition: SBType.cpp:77
lldb::SBTypeEnumMember
Definition: SBTypeEnumMember.h:17
lldb::SBType::~SBType
~SBType()
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:208
lldb::SBTypeMemberFunction::GetDemangledName
const char * GetDemangledName()
Definition: SBType.cpp:808
LLDB_API
#define LLDB_API
Definition: SBDefines.h:26