#ifndef liblldb_Type_h_
#define liblldb_Type_h_
#include "lldb/lldb-private.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UserID.h"
#include "lldb/Symbol/Declaration.h"
#include <set>
namespace lldb_private {
class Type : public UserID
{
public:
typedef enum EncodingDataTypeTag
{
eEncodingInvalid,
eEncodingIsUID, eEncodingIsConstUID, eEncodingIsRestrictUID, eEncodingIsVolatileUID, eEncodingIsTypedefUID, eEncodingIsPointerUID, eEncodingIsLValueReferenceUID, eEncodingIsRValueReferenceUID, eEncodingIsSyntheticUID
} EncodingDataType;
typedef enum ResolveStateTag
{
eResolveStateUnresolved = 0,
eResolveStateForward = 1,
eResolveStateLayout = 2,
eResolveStateFull = 3
} ResolveState;
Type (lldb::user_id_t uid,
SymbolFile* symbol_file,
const ConstString &name,
uint32_t byte_size,
SymbolContextScope *context,
lldb::user_id_t encoding_uid,
EncodingDataType encoding_uid_type,
const Declaration& decl,
lldb::clang_type_t clang_qual_type,
ResolveState clang_type_resolve_state);
Type();
Type (const Type &rhs);
const Type&
operator= (const Type& rhs);
void
Dump(Stream *s, bool show_context);
void
DumpTypeName(Stream *s);
void
GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name);
SymbolFile *
GetSymbolFile()
{
return m_symbol_file;
}
const SymbolFile *
GetSymbolFile() const
{
return m_symbol_file;
}
TypeList*
GetTypeList();
const ConstString&
GetName();
uint32_t
GetByteSize();
uint32_t
GetNumChildren (bool omit_empty_base_classes);
bool
IsAggregateType ();
bool
IsValidType ()
{
return m_encoding_uid_type != eEncodingInvalid;
}
void
SetByteSize(uint32_t byte_size);
const ConstString &
GetName () const
{
return m_name;
}
void
DumpValue(ExecutionContext *exe_ctx,
Stream *s,
const DataExtractor &data,
uint32_t data_offset,
bool show_type,
bool show_summary,
bool verbose,
lldb::Format format = lldb::eFormatDefault);
bool
DumpValueInMemory(ExecutionContext *exe_ctx,
Stream *s,
lldb::addr_t address,
AddressType address_type,
bool show_types,
bool show_summary,
bool verbose);
bool
ReadFromMemory (ExecutionContext *exe_ctx,
lldb::addr_t address,
AddressType address_type,
DataExtractor &data);
bool
WriteToMemory (ExecutionContext *exe_ctx,
lldb::addr_t address,
AddressType address_type,
DataExtractor &data);
bool
GetIsDeclaration() const;
void
SetIsDeclaration(bool b);
bool
GetIsExternal() const;
void
SetIsExternal(bool b);
lldb::Format
GetFormat ();
lldb::Encoding
GetEncoding (uint32_t &count);
SymbolContextScope *
GetSymbolContextScope()
{
return m_context;
}
const SymbolContextScope *
GetSymbolContextScope() const
{
return m_context;
}
void
SetSymbolContextScope(SymbolContextScope *context)
{
m_context = context;
}
const lldb_private::Declaration &
GetDeclaration () const;
lldb::clang_type_t
GetClangFullType ();
lldb::clang_type_t
GetClangLayoutType ();
lldb::clang_type_t
GetClangForwardType ();
clang::ASTContext *
GetClangAST ();
ClangASTContext &
GetClangASTContext ();
static int
Compare(const Type &a, const Type &b);
void
SetEncodingType (Type *encoding_type)
{
m_encoding_type = encoding_type;
}
uint32_t
GetEncodingMask ();
void *
CreateClangPointerType (Type *type);
void *
CreateClangTypedefType (Type *typedef_type, Type *base_type);
void *
CreateClangLValueReferenceType (Type *type);
void *
CreateClangRValueReferenceType (Type *type);
protected:
ConstString m_name;
SymbolFile *m_symbol_file;
SymbolContextScope *m_context; Type *m_encoding_type;
uint32_t m_encoding_uid;
EncodingDataType m_encoding_uid_type;
uint32_t m_byte_size;
Declaration m_decl;
lldb::clang_type_t m_clang_type;
ResolveState m_clang_type_resolve_state;
Type *
GetEncodingType ();
bool
ResolveClangType (ResolveState clang_type_resolve_state);
};
class TypeAndOrName
{
public:
TypeAndOrName ();
TypeAndOrName (lldb::TypeSP &type_sp);
TypeAndOrName (const char *type_str);
TypeAndOrName (const TypeAndOrName &rhs);
TypeAndOrName (ConstString &type_const_string);
TypeAndOrName &
operator= (const TypeAndOrName &rhs);
ConstString GetName () const;
lldb::TypeSP GetTypeSP () const {
return m_type_sp;
};
void
SetName (ConstString &type_name_const_str);
void
SetName (const char *type_name_str);
void
SetTypeSP (lldb::TypeSP type_sp);
bool
IsEmpty ();
private:
lldb::TypeSP m_type_sp;
ConstString m_type_name;
};
}
#endif // liblldb_Type_h_