SBType.h revision 102b2c2681c9a830afe25bfea35557421905e42c
1//===-- SBType.h ------------------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef LLDB_SBType_h_ 11#define LLDB_SBType_h_ 12 13#include "lldb/API/SBDefines.h" 14 15namespace lldb { 16 17class SBTypeList; 18 19class SBTypeMember 20{ 21public: 22 SBTypeMember (); 23 24 SBTypeMember (const lldb::SBTypeMember& rhs); 25 26 ~SBTypeMember(); 27 28 lldb::SBTypeMember& 29 operator = (const lldb::SBTypeMember& rhs); 30 31 bool 32 IsValid() const; 33 34 const char * 35 GetName (); 36 37 lldb::SBType 38 GetType (); 39 40 uint64_t 41 GetOffsetInBytes(); 42 43 uint64_t 44 GetOffsetInBits(); 45 46 bool 47 IsBitfield(); 48 49 uint32_t 50 GetBitfieldSizeInBits(); 51 52 bool 53 GetDescription (lldb::SBStream &description, 54 lldb::DescriptionLevel description_level); 55 56protected: 57 friend class SBType; 58 59 void 60 reset (lldb_private::TypeMemberImpl *); 61 62 lldb_private::TypeMemberImpl & 63 ref (); 64 65 const lldb_private::TypeMemberImpl & 66 ref () const; 67 68 std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap; 69}; 70 71class SBType 72{ 73public: 74 75 SBType(); 76 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 lldb::SBType 97 GetPointerType(); 98 99 lldb::SBType 100 GetPointeeType(); 101 102 lldb::SBType 103 GetReferenceType(); 104 105 lldb::SBType 106 GetDereferencedType(); 107 108 lldb::SBType 109 GetUnqualifiedType(); 110 111 lldb::SBType 112 GetCanonicalType(); 113 // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic 114 // type eBasicTypeInvalid will be returned 115 lldb::BasicType 116 GetBasicType(); 117 118 // The call below confusing and should really be renamed to "CreateBasicType" 119 lldb::SBType 120 GetBasicType(lldb::BasicType type); 121 122 uint32_t 123 GetNumberOfFields (); 124 125 uint32_t 126 GetNumberOfDirectBaseClasses (); 127 128 uint32_t 129 GetNumberOfVirtualBaseClasses (); 130 131 lldb::SBTypeMember 132 GetFieldAtIndex (uint32_t idx); 133 134 lldb::SBTypeMember 135 GetDirectBaseClassAtIndex (uint32_t idx); 136 137 lldb::SBTypeMember 138 GetVirtualBaseClassAtIndex (uint32_t idx); 139 140 uint32_t 141 GetNumberOfTemplateArguments (); 142 143 lldb::SBType 144 GetTemplateArgumentType (uint32_t idx); 145 146 lldb::TemplateArgumentKind 147 GetTemplateArgumentKind (uint32_t idx); 148 149 lldb::SBType 150 GetFunctionReturnType (); 151 152 lldb::SBTypeList 153 GetFunctionArgumentTypes (); 154 155 const char* 156 GetName(); 157 158 lldb::TypeClass 159 GetTypeClass (); 160 161 bool 162 IsTypeComplete (); 163 164 // DEPRECATED: but needed for Xcode right now 165 static bool 166 IsPointerType (void * clang_type); 167 168 bool 169 GetDescription (lldb::SBStream &description, 170 lldb::DescriptionLevel description_level); 171 172 lldb::SBType & 173 operator = (const lldb::SBType &rhs); 174 175 bool 176 operator == (lldb::SBType &rhs); 177 178 bool 179 operator != (lldb::SBType &rhs); 180 181protected: 182 183 lldb_private::TypeImpl & 184 ref (); 185 186 const lldb_private::TypeImpl & 187 ref () const; 188 189 lldb::TypeImplSP 190 GetSP (); 191 192 void 193 SetSP (const lldb::TypeImplSP &type_impl_sp); 194 195 lldb::TypeImplSP m_opaque_sp; 196 197 friend class SBFunction; 198 friend class SBModule; 199 friend class SBTarget; 200 friend class SBTypeNameSpecifier; 201 friend class SBTypeMember; 202 friend class SBTypeList; 203 friend class SBValue; 204 205 SBType (const lldb_private::ClangASTType &); 206 SBType (const lldb::TypeSP &); 207 SBType (const lldb::TypeImplSP &); 208 209}; 210 211class SBTypeList 212{ 213public: 214 SBTypeList(); 215 216 SBTypeList(const lldb::SBTypeList& rhs); 217 218 ~SBTypeList(); 219 220 lldb::SBTypeList& 221 operator = (const lldb::SBTypeList& rhs); 222 223 bool 224 IsValid(); 225 226 void 227 Append (lldb::SBType type); 228 229 lldb::SBType 230 GetTypeAtIndex (uint32_t index); 231 232 uint32_t 233 GetSize(); 234 235 236private: 237 std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap; 238}; 239 240 241} // namespace lldb 242 243#endif // LLDB_SBType_h_ 244