From e0afce767a500049184e294cb138a2f3fad0c3e0 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Tue, 28 Oct 2014 21:44:06 +0000 Subject: [PATCH] Add a few functions to SBType to handle arrays and typedefs. Fixes rdar://12675166 llvm-svn: 220824 --- lldb/include/lldb/API/SBType.h | 9 +++++++++ lldb/scripts/Python/interface/SBType.i | 9 +++++++++ lldb/source/API/SBType.cpp | 24 +++++++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index dea87a9..303ddff 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -149,6 +149,12 @@ public: bool IsPolymorphicClass (); + bool + IsArrayType (); + + bool + IsTypedefType (); + lldb::SBType GetPointerType(); @@ -166,6 +172,9 @@ public: lldb::SBType GetUnqualifiedType(); + + lldb::SBType + GetArrayElementType (); lldb::SBType GetCanonicalType(); diff --git a/lldb/scripts/Python/interface/SBType.i b/lldb/scripts/Python/interface/SBType.i index 2980cdb..a9c230c 100644 --- a/lldb/scripts/Python/interface/SBType.i +++ b/lldb/scripts/Python/interface/SBType.i @@ -206,6 +206,12 @@ public: bool IsPolymorphicClass (); + bool + IsArrayType (); + + bool + IsTypedefType (); + lldb::SBType GetPointerType(); @@ -226,6 +232,9 @@ public: lldb::SBType GetCanonicalType(); + + lldb::SBType + GetArrayElementType (); lldb::BasicType GetBasicType(); diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index 189cf81..8a0f5d8 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -156,6 +156,14 @@ SBType::IsPointerType() } bool +SBType::IsArrayType() +{ + if (!IsValid()) + return false; + return m_opaque_sp->GetClangASTType(true).IsArrayType(nullptr, nullptr, nullptr); +} + +bool SBType::IsReferenceType() { if (!IsValid()) @@ -204,6 +212,14 @@ SBType::GetDereferencedType() return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetDereferencedType()))); } +SBType +SBType::GetArrayElementType() +{ + if (!IsValid()) + return SBType(); + return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetClangASTType(true).GetArrayElementType()))); +} + bool SBType::IsFunctionType () { @@ -220,7 +236,13 @@ SBType::IsPolymorphicClass () return m_opaque_sp->GetClangASTType(true).IsPolymorphicClass(); } - +bool +SBType::IsTypedefType () +{ + if (!IsValid()) + return false; + return m_opaque_sp->GetClangASTType(true).IsTypedefType(); +} lldb::SBType SBType::GetFunctionReturnType () -- 2.7.4