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