Added the ability to get the type that a typedef points to via:

SBType SBType::GetTypedefedType();

Also added the ability to get a type by type ID from a SBModule:

SBType SBModule::GetTypeByID (lldb::user_id_t uid);

llvm-svn: 199939
This commit is contained in:
Greg Clayton 2014-01-23 21:38:34 +00:00
parent b1ce33379a
commit 1f4db7da8f
8 changed files with 75 additions and 1 deletions

View File

@ -235,6 +235,25 @@ public:
lldb::SBTypeList
FindTypes (const char* type);
//------------------------------------------------------------------
/// Get a type using its type ID.
///
/// Each symbol file reader will assign different user IDs to their
/// types, but it is sometimes useful when debugging type issues to
/// be able to grab a type using its type ID.
///
/// For DWARF debug info, the type ID is the DIE offset.
///
/// @param[in] uid
/// The type user ID.
///
/// @return
/// An SBType for the given type ID, or an empty SBType if the
/// type was not found.
//------------------------------------------------------------------
lldb::SBType
GetTypeByID (lldb::user_id_t uid);
lldb::SBType
GetBasicType(lldb::BasicType type);

View File

@ -105,6 +105,9 @@ public:
lldb::SBType
GetReferenceType();
lldb::SBType
GetTypedefedType();
lldb::SBType
GetDereferencedType();

View File

@ -417,7 +417,15 @@ public:
return type_sp->GetClangLayoutType().GetLValueReferenceType();
return clang_type.GetLValueReferenceType();
}
ClangASTType
GetTypedefedType () const
{
if (type_sp)
return type_sp->GetClangFullType().GetTypedefedType();
return clang_type.GetTypedefedType();
}
ClangASTType
GetDereferencedType () const
{
@ -512,6 +520,9 @@ public:
TypeImpl
GetReferenceType () const;
TypeImpl
GetTypedefedType () const;
TypeImpl
GetDereferencedType () const;

View File

@ -230,6 +230,9 @@ public:
lldb::SBTypeList
FindTypes (const char* type);
lldb::SBType
GetTypeByID (lldb::user_id_t uid);
lldb::SBType
GetBasicType(lldb::BasicType type);

View File

@ -177,6 +177,9 @@ public:
lldb::SBType
GetReferenceType();
lldb::SBType
SBType::GetTypedefedType();
lldb::SBType
GetDereferencedType();

View File

@ -579,6 +579,23 @@ SBModule::FindTypes (const char *type)
return retval;
}
lldb::SBType
SBModule::GetTypeByID (lldb::user_id_t uid)
{
ModuleSP module_sp (GetSP ());
if (module_sp)
{
SymbolVendor* vendor = module_sp->GetSymbolVendor();
if (vendor)
{
Type *type_ptr = vendor->ResolveTypeUID(uid);
if (type_ptr)
return SBType(type_ptr->shared_from_this());
}
}
return SBType();
}
lldb::SBTypeList
SBModule::GetTypes (uint32_t type_mask)
{

View File

@ -185,6 +185,14 @@ SBType::GetReferenceType()
return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetReferenceType())));
}
SBType
SBType::GetTypedefedType()
{
if (!IsValid())
return SBType();
return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetTypedefedType())));
}
SBType
SBType::GetDereferencedType()
{

View File

@ -1083,6 +1083,16 @@ TypeImpl::GetReferenceType () const
return TypeImpl(m_static_type.GetReferenceType());
}
TypeImpl
TypeImpl::GetTypedefedType () const
{
if (m_dynamic_type.IsValid())
{
return TypeImpl(m_static_type, m_dynamic_type.GetTypedefedType());
}
return TypeImpl(m_static_type.GetTypedefedType());
}
TypeImpl
TypeImpl::GetDereferencedType () const
{