Add a few functions to SBType to handle arrays and typedefs. Fixes rdar://12675166
authorEnrico Granata <egranata@apple.com>
Tue, 28 Oct 2014 21:44:06 +0000 (21:44 +0000)
committerEnrico Granata <egranata@apple.com>
Tue, 28 Oct 2014 21:44:06 +0000 (21:44 +0000)
llvm-svn: 220824

lldb/include/lldb/API/SBType.h
lldb/scripts/Python/interface/SBType.i
lldb/source/API/SBType.cpp

index dea87a9..303ddff 100644 (file)
@@ -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();
index 2980cdb..a9c230c 100644 (file)
@@ -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();
index 189cf81..8a0f5d8 100644 (file)
@@ -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 ()