SBType.h revision 269024
1161748Scperciva//===-- SBType.h ------------------------------------------------*- C++ -*-===//
2161748Scperciva//
3161748Scperciva//                     The LLVM Compiler Infrastructure
4161748Scperciva//
5161748Scperciva// This file is distributed under the University of Illinois Open Source
6161748Scperciva// License. See LICENSE.TXT for details.
7161748Scperciva//
8161748Scperciva//===----------------------------------------------------------------------===//
9161748Scperciva
10161748Scperciva#ifndef LLDB_SBType_h_
11161748Scperciva#define LLDB_SBType_h_
12161748Scperciva
13161748Scperciva#include "lldb/API/SBDefines.h"
14161748Scperciva
15161748Scpercivanamespace lldb {
16161748Scperciva
17161748Scpercivaclass SBTypeList;
18161748Scperciva
19161748Scpercivaclass SBTypeMember
20161748Scperciva{
21161748Scpercivapublic:
22161748Scperciva    SBTypeMember ();
23161748Scperciva
24181145Scperciva    SBTypeMember (const lldb::SBTypeMember& rhs);
25181145Scperciva
26181145Scperciva    ~SBTypeMember();
27181427Scperciva
28181427Scperciva    lldb::SBTypeMember&
29181427Scperciva    operator = (const lldb::SBTypeMember& rhs);
30181145Scperciva
31161748Scperciva    bool
32161748Scperciva    IsValid() const;
33173564Scperciva
34174057Scperciva    const char *
35161748Scperciva    GetName ();
36173564Scperciva
37173564Scperciva    lldb::SBType
38177602Scperciva    GetType ();
39173564Scperciva
40161748Scperciva    uint64_t
41161748Scperciva    GetOffsetInBytes();
42161748Scperciva
43161748Scperciva    uint64_t
44161748Scperciva    GetOffsetInBits();
45161748Scperciva
46161748Scperciva    bool
47161748Scperciva    IsBitfield();
48161748Scperciva
49161748Scperciva    uint32_t
50161748Scperciva    GetBitfieldSizeInBits();
51161748Scperciva
52161748Scperciva    bool
53161748Scperciva    GetDescription (lldb::SBStream &description,
54161748Scperciva                    lldb::DescriptionLevel description_level);
55161748Scperciva
56161748Scpercivaprotected:
57161748Scperciva    friend class SBType;
58161748Scperciva
59161748Scperciva    void
60173564Scperciva    reset (lldb_private::TypeMemberImpl *);
61173564Scperciva
62173564Scperciva    lldb_private::TypeMemberImpl &
63173564Scperciva    ref ();
64173564Scperciva
65173564Scperciva    const lldb_private::TypeMemberImpl &
66196392Ssimon    ref () const;
67196392Ssimon
68196392Ssimon    std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
69196392Ssimon};
70196392Ssimon
71196392Ssimonclass SBType
72196392Ssimon{
73196392Ssimonpublic:
74196392Ssimon
75196392Ssimon    SBType();
76196392Ssimon
77    SBType (const lldb::SBType &rhs);
78
79    ~SBType ();
80
81    bool
82    IsValid() const;
83
84    uint64_t
85    GetByteSize();
86
87    bool
88    IsPointerType();
89
90    bool
91    IsReferenceType();
92
93    bool
94    IsFunctionType ();
95
96    bool
97    IsPolymorphicClass ();
98
99    lldb::SBType
100    GetPointerType();
101
102    lldb::SBType
103    GetPointeeType();
104
105    lldb::SBType
106    GetReferenceType();
107
108    lldb::SBType
109    GetTypedefedType();
110
111    lldb::SBType
112    GetDereferencedType();
113
114    lldb::SBType
115    GetUnqualifiedType();
116
117    lldb::SBType
118    GetCanonicalType();
119    // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
120    // type eBasicTypeInvalid will be returned
121    lldb::BasicType
122    GetBasicType();
123
124    // The call below confusing and should really be renamed to "CreateBasicType"
125    lldb::SBType
126    GetBasicType(lldb::BasicType type);
127
128    uint32_t
129    GetNumberOfFields ();
130
131    uint32_t
132    GetNumberOfDirectBaseClasses ();
133
134    uint32_t
135    GetNumberOfVirtualBaseClasses ();
136
137    lldb::SBTypeMember
138    GetFieldAtIndex (uint32_t idx);
139
140    lldb::SBTypeMember
141    GetDirectBaseClassAtIndex (uint32_t idx);
142
143    lldb::SBTypeMember
144    GetVirtualBaseClassAtIndex (uint32_t idx);
145
146    uint32_t
147    GetNumberOfTemplateArguments ();
148
149    lldb::SBType
150    GetTemplateArgumentType (uint32_t idx);
151
152    lldb::TemplateArgumentKind
153    GetTemplateArgumentKind (uint32_t idx);
154
155    lldb::SBType
156    GetFunctionReturnType ();
157
158    lldb::SBTypeList
159    GetFunctionArgumentTypes ();
160
161    const char*
162    GetName();
163
164    lldb::TypeClass
165    GetTypeClass ();
166
167    bool
168    IsTypeComplete ();
169
170    bool
171    GetDescription (lldb::SBStream &description,
172                    lldb::DescriptionLevel description_level);
173
174    lldb::SBType &
175    operator = (const lldb::SBType &rhs);
176
177    bool
178    operator == (lldb::SBType &rhs);
179
180    bool
181    operator != (lldb::SBType &rhs);
182
183protected:
184
185    lldb_private::TypeImpl &
186    ref ();
187
188    const lldb_private::TypeImpl &
189    ref () const;
190
191    lldb::TypeImplSP
192    GetSP ();
193
194    void
195    SetSP (const lldb::TypeImplSP &type_impl_sp);
196
197    lldb::TypeImplSP m_opaque_sp;
198
199    friend class SBFunction;
200    friend class SBModule;
201    friend class SBTarget;
202    friend class SBTypeNameSpecifier;
203    friend class SBTypeMember;
204    friend class SBTypeList;
205    friend class SBValue;
206
207    SBType (const lldb_private::ClangASTType &);
208    SBType (const lldb::TypeSP &);
209    SBType (const lldb::TypeImplSP &);
210
211};
212
213class SBTypeList
214{
215public:
216    SBTypeList();
217
218    SBTypeList(const lldb::SBTypeList& rhs);
219
220    ~SBTypeList();
221
222    lldb::SBTypeList&
223    operator = (const lldb::SBTypeList& rhs);
224
225    bool
226    IsValid();
227
228    void
229    Append (lldb::SBType type);
230
231    lldb::SBType
232    GetTypeAtIndex (uint32_t index);
233
234    uint32_t
235    GetSize();
236
237
238private:
239    std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
240    friend class SBModule;
241    friend class SBCompileUnit;
242};
243
244
245} // namespace lldb
246
247#endif // LLDB_SBType_h_
248