[Lldb-commits] [lldb] r169424 - in /lldb/trunk: include/lldb/API/SBModule.h include/lldb/API/SBTarget.h include/lldb/Core/Module.h include/lldb/Symbol/ClangASTType.h scripts/Python/interface/SBModule.i scripts/Python/interface/SBTarget.i source/API/SBModule.cpp source/API/SBTarget.cpp source/API/SBType.cpp source/Core/Module.cpp source/Symbol/ClangASTType.cpp

Greg Clayton gclayton at apple.com
Wed Dec 5 13:24:42 PST 2012


Author: gclayton
Date: Wed Dec  5 15:24:42 2012
New Revision: 169424

URL: http://llvm.org/viewvc/llvm-project?rev=169424&view=rev
Log:
<rdar://problem/12749733>

Always allows getting builtin types by name even if there is no backing debug information.


Modified:
    lldb/trunk/include/lldb/API/SBModule.h
    lldb/trunk/include/lldb/API/SBTarget.h
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Symbol/ClangASTType.h
    lldb/trunk/scripts/Python/interface/SBModule.i
    lldb/trunk/scripts/Python/interface/SBTarget.i
    lldb/trunk/source/API/SBModule.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/API/SBType.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Symbol/ClangASTType.cpp

Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Wed Dec  5 15:24:42 2012
@@ -181,6 +181,8 @@
     lldb::SBTypeList
     FindTypes (const char* type);
     
+    lldb::SBType
+    GetBasicType(lldb::BasicType type);
     
     //------------------------------------------------------------------
     /// Get the module version numbers.

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Wed Dec  5 15:24:42 2012
@@ -719,6 +719,9 @@
     lldb::SBTypeList
     FindTypes (const char* type);
     
+    lldb::SBType
+    GetBasicType(lldb::BasicType type);
+    
     SBSourceManager
     GetSourceManager();
     

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Wed Dec  5 15:24:42 2012
@@ -408,6 +408,11 @@
                uint32_t max_matches,
                TypeList& types);
 
+    lldb::TypeSP
+    FindFirstType (const SymbolContext& sc,
+                   const ConstString &type_name,
+                   bool exact_match);
+
     //------------------------------------------------------------------
     /// Find types by name that are in a namespace. This function is
     /// used by the expression parser when searches need to happen in

Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTType.h?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTType.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTType.h Wed Dec  5 15:24:42 2012
@@ -82,6 +82,15 @@
     ConstString
     GetConstQualifiedTypeName ();
 
+    static lldb::BasicType
+    GetBasicTypeEnumeration (const ConstString &name);
+
+    static ClangASTType
+    GetBasicType (clang::ASTContext *ast, lldb::BasicType type);
+
+    static ClangASTType
+    GetBasicType (clang::ASTContext *ast, const ConstString &name);
+
     static ConstString
     GetConstTypeName (clang::ASTContext *ast,
                       lldb::clang_type_t clang_type);

Modified: lldb/trunk/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBModule.i (original)
+++ lldb/trunk/scripts/Python/interface/SBModule.i Wed Dec  5 15:24:42 2012
@@ -222,6 +222,8 @@
     lldb::SBTypeList
     FindTypes (const char* type);
 
+    lldb::SBType
+    GetBasicType(lldb::BasicType type);
 
     %feature("docstring", "
     //------------------------------------------------------------------

Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Wed Dec  5 15:24:42 2012
@@ -560,6 +560,9 @@
     lldb::SBTypeList
     FindTypes (const char* type);
 
+    lldb::SBType
+    GetBasicType(lldb::BasicType type);
+
     lldb::SBSourceManager
     GetSourceManager ();
 

Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Wed Dec  5 15:24:42 2012
@@ -488,27 +488,29 @@
     if (name_cstr && module_sp)
     {
         SymbolContext sc;
-        TypeList type_list;
-        uint32_t num_matches = 0;
         const bool exact_match = false;
         ConstString name(name_cstr);
 
-        num_matches = module_sp->FindTypes (sc,
-                                            name,
-                                            exact_match,
-                                            1,
-                                            type_list);
+        sb_type = SBType (module_sp->FindFirstType(sc, name, exact_match));
         
-        if (num_matches)
-            sb_type = lldb::SBType(type_list.GetTypeAtIndex(0));
+        if (!sb_type.IsValid())
+            sb_type = SBType (ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
     }
     return sb_type;
 }
 
+lldb::SBType
+SBModule::GetBasicType(lldb::BasicType type)
+{
+    ModuleSP module_sp (GetSP ());
+    if (module_sp)
+        return SBType (ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), type));
+    return SBType();
+}
+
 lldb::SBTypeList
 SBModule::FindTypes (const char *type)
 {
-    
     SBTypeList retval;
     
     ModuleSP module_sp (GetSP ());
@@ -517,20 +519,27 @@
         SymbolContext sc;
         TypeList type_list;
         const bool exact_match = false;
-        uint32_t num_matches = 0;
         ConstString name(type);
+        const uint32_t num_matches = module_sp->FindTypes (sc,
+                                                           name,
+                                                           exact_match,
+                                                           UINT32_MAX,
+                                                           type_list);
         
-        num_matches = module_sp->FindTypes (sc,
-                                            name,
-                                            exact_match,
-                                            UINT32_MAX,
-                                            type_list);
-            
-        for (size_t idx = 0; idx < num_matches; idx++)
+        if (num_matches > 0)
+        {
+            for (size_t idx = 0; idx < num_matches; idx++)
+            {
+                TypeSP type_sp (type_list.GetTypeAtIndex(idx));
+                if (type_sp)
+                    retval.Append(SBType(type_sp));
+            }
+        }
+        else
         {
-            TypeSP type_sp (type_list.GetTypeAtIndex(idx));
-            if (type_sp)
-                retval.Append(SBType(type_sp));
+            SBType sb_type(ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
+            if (sb_type.IsValid())
+                retval.Append(sb_type);
         }
     }
 

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Dec  5 15:24:42 2012
@@ -2064,52 +2064,87 @@
 }
 
 lldb::SBType
-SBTarget::FindFirstType (const char* type)
+SBTarget::FindFirstType (const char* typename_cstr)
 {
     TargetSP target_sp(GetSP());
-    if (type && target_sp)
+    if (typename_cstr && typename_cstr[0] && target_sp)
     {
-        size_t count = target_sp->GetImages().GetSize();
+        ConstString const_typename(typename_cstr);
+        SymbolContext sc;
+        const bool exact_match = false;
+
+        const ModuleList &module_list = target_sp->GetImages();
+        size_t count = module_list.GetSize();
         for (size_t idx = 0; idx < count; idx++)
         {
-            SBType found_at_idx = GetModuleAtIndex(idx).FindFirstType(type);
-            
-            if (found_at_idx.IsValid())
-                return found_at_idx;
+            ModuleSP module_sp (module_list.GetModuleAtIndex(idx));
+            if (module_sp)
+            {
+                TypeSP type_sp (module_sp->FindFirstType(sc, const_typename, exact_match));
+                if (type_sp)
+                    return SBType(type_sp);
+            }
         }
+
+        // No matches, search for basic typename matches
+        ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
+        if (clang_ast)
+            return SBType (ClangASTType::GetBasicType (clang_ast->getASTContext(), const_typename));
     }
     return SBType();
 }
 
+SBType
+SBTarget::GetBasicType(lldb::BasicType type)
+{
+    TargetSP target_sp(GetSP());
+    if (target_sp)
+    {
+        ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
+        if (clang_ast)
+            return SBType (ClangASTType::GetBasicType (clang_ast->getASTContext(), type));
+    }
+    return SBType();
+}
+
+
 lldb::SBTypeList
-SBTarget::FindTypes (const char* type)
+SBTarget::FindTypes (const char* typename_cstr)
 {
-    
-    SBTypeList retval;
-    
+    SBTypeList sb_type_list;
     TargetSP target_sp(GetSP());
-    if (type && target_sp)
+    if (typename_cstr && typename_cstr[0] && target_sp)
     {
         ModuleList& images = target_sp->GetImages();
-        ConstString name_const(type);
+        ConstString const_typename(typename_cstr);
         bool exact_match = false;
         SymbolContext sc;
         TypeList type_list;
         
         uint32_t num_matches = images.FindTypes (sc,
-                                                 name_const,
+                                                 const_typename,
                                                  exact_match,
                                                  UINT32_MAX,
                                                  type_list);
         
-        for (size_t idx = 0; idx < num_matches; idx++)
+        if (num_matches > 0)
+        {
+            for (size_t idx = 0; idx < num_matches; idx++)
+            {
+                TypeSP type_sp (type_list.GetTypeAtIndex(idx));
+                if (type_sp)
+                    sb_type_list.Append(SBType(type_sp));
+            }
+        }
+        else
         {
-            TypeSP type_sp (type_list.GetTypeAtIndex(idx));
-            if (type_sp)
-                retval.Append(SBType(type_sp));
+            // No matches, search for basic typename matches
+            ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
+            if (clang_ast)
+                sb_type_list.Append (SBType (ClangASTType::GetBasicType (clang_ast->getASTContext(), const_typename)));
         }
     }
-    return retval;
+    return sb_type_list;
 }
 
 SBValueList

Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Wed Dec  5 15:24:42 2012
@@ -285,111 +285,9 @@
 SBType
 SBType::GetBasicType(lldb::BasicType type)
 {
-    if (!IsValid())
-        return SBType();
-    
-    clang::QualType base_type_qual;
-    
-    switch (type)
-    {
-        case eBasicTypeVoid:
-            base_type_qual = m_opaque_sp->GetASTContext()->VoidTy;
-            break;
-        case eBasicTypeChar:
-            base_type_qual = m_opaque_sp->GetASTContext()->CharTy;
-            break;
-        case eBasicTypeSignedChar:
-            base_type_qual = m_opaque_sp->GetASTContext()->SignedCharTy;
-            break;
-        case eBasicTypeUnsignedChar:
-            base_type_qual = m_opaque_sp->GetASTContext()->UnsignedCharTy;
-            break;
-        case eBasicTypeWChar:
-            base_type_qual = m_opaque_sp->GetASTContext()->getWCharType();
-            break;
-        case eBasicTypeSignedWChar:
-            base_type_qual = m_opaque_sp->GetASTContext()->getSignedWCharType();
-            break;
-        case eBasicTypeUnsignedWChar:
-            base_type_qual = m_opaque_sp->GetASTContext()->getUnsignedWCharType();
-            break;
-        case eBasicTypeChar16:
-            base_type_qual = m_opaque_sp->GetASTContext()->Char16Ty;
-            break;
-        case eBasicTypeChar32:
-            base_type_qual = m_opaque_sp->GetASTContext()->Char32Ty;
-            break;
-        case eBasicTypeShort:
-            base_type_qual = m_opaque_sp->GetASTContext()->ShortTy;
-            break;
-        case eBasicTypeUnsignedShort:
-            base_type_qual = m_opaque_sp->GetASTContext()->UnsignedShortTy;
-            break;
-        case eBasicTypeInt:
-            base_type_qual = m_opaque_sp->GetASTContext()->IntTy;
-            break;
-        case eBasicTypeUnsignedInt:
-            base_type_qual = m_opaque_sp->GetASTContext()->UnsignedIntTy;
-            break;
-        case eBasicTypeLong:
-            base_type_qual = m_opaque_sp->GetASTContext()->LongTy;
-            break;
-        case eBasicTypeUnsignedLong:
-            base_type_qual = m_opaque_sp->GetASTContext()->UnsignedLongTy;
-            break;
-        case eBasicTypeLongLong:
-            base_type_qual = m_opaque_sp->GetASTContext()->LongLongTy;
-            break;
-        case eBasicTypeUnsignedLongLong:
-            base_type_qual = m_opaque_sp->GetASTContext()->UnsignedLongLongTy;
-            break;
-        case eBasicTypeInt128:
-            base_type_qual = m_opaque_sp->GetASTContext()->Int128Ty;
-            break;
-        case eBasicTypeUnsignedInt128:
-            base_type_qual = m_opaque_sp->GetASTContext()->UnsignedInt128Ty;
-            break;
-        case eBasicTypeBool:
-            base_type_qual = m_opaque_sp->GetASTContext()->BoolTy;
-            break;
-        case eBasicTypeHalf:
-            base_type_qual = m_opaque_sp->GetASTContext()->HalfTy;
-            break;
-        case eBasicTypeFloat:
-            base_type_qual = m_opaque_sp->GetASTContext()->FloatTy;
-            break;
-        case eBasicTypeDouble:
-            base_type_qual = m_opaque_sp->GetASTContext()->DoubleTy;
-            break;
-        case eBasicTypeLongDouble:
-            base_type_qual = m_opaque_sp->GetASTContext()->LongDoubleTy;
-            break;
-        case eBasicTypeFloatComplex:
-            base_type_qual = m_opaque_sp->GetASTContext()->FloatComplexTy;
-            break;
-        case eBasicTypeDoubleComplex:
-            base_type_qual = m_opaque_sp->GetASTContext()->DoubleComplexTy;
-            break;
-        case eBasicTypeLongDoubleComplex:
-            base_type_qual = m_opaque_sp->GetASTContext()->LongDoubleComplexTy;
-            break;
-        case eBasicTypeObjCID:
-            base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinIdTy;
-            break;
-        case eBasicTypeObjCClass:
-            base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinClassTy;
-            break;
-        case eBasicTypeObjCSel:
-            base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinSelTy;
-            break;
-        case eBasicTypeNullPtr:
-            base_type_qual = m_opaque_sp->GetASTContext()->NullPtrTy;
-            break;
-        default:
-            return SBType();
-    }
-    
-    return SBType(ClangASTType(m_opaque_sp->GetASTContext(), base_type_qual.getAsOpaquePtr()));
+    if (IsValid())
+        return SBType (ClangASTType::GetBasicType (m_opaque_sp->GetASTContext(), type));
+    return SBType();
 }
 
 uint32_t

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Dec  5 15:24:42 2012
@@ -690,6 +690,19 @@
     return FindTypes_Impl(sc, type_name, namespace_decl, append, max_matches, type_list);
 }
 
+lldb::TypeSP
+Module::FindFirstType (const SymbolContext& sc,
+                       const ConstString &name,
+                       bool exact_match)
+{
+    TypeList type_list;
+    const uint32_t num_matches = FindTypes (sc, name, exact_match, 1, type_list);
+    if (num_matches)
+        return type_list.GetTypeAtIndex(0);
+    return TypeSP();
+}
+
+
 uint32_t
 Module::FindTypes (const SymbolContext& sc,
                    const ConstString &name,

Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=169424&r1=169423&r2=169424&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Wed Dec  5 15:24:42 2012
@@ -1,4 +1,4 @@
-//===-- ClangASTType.cpp ---------------------------------------------*- C++ -*-===//
+//===-- ClangASTType.cpp ----------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -36,10 +36,13 @@
 #include "lldb/Core/Scalar.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamString.h"
+#include "lldb/Core/UniqueCStringMap.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 
+#include <mutex>
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -1787,3 +1790,191 @@
 {
     return lhs.GetASTContext() != rhs.GetASTContext() || lhs.GetOpaqueQualType() != rhs.GetOpaqueQualType();
 }
+
+lldb::BasicType
+ClangASTType::GetBasicTypeEnumeration (const ConstString &name)
+{
+    if (name)
+    {
+        typedef UniqueCStringMap<lldb::BasicType> TypeNameToBasicTypeMap;
+        static TypeNameToBasicTypeMap g_type_map;
+        static std::once_flag g_once_flag;
+        std::call_once(g_once_flag, [](){
+            // "void"
+            g_type_map.Append(ConstString("void").GetCString(), eBasicTypeVoid);
+            
+            // "char"
+            g_type_map.Append(ConstString("char").GetCString(), eBasicTypeChar);
+            g_type_map.Append(ConstString("signed char").GetCString(), eBasicTypeSignedChar);
+            g_type_map.Append(ConstString("unsigned char").GetCString(), eBasicTypeUnsignedChar);
+            g_type_map.Append(ConstString("wchar_t").GetCString(), eBasicTypeWChar);
+            g_type_map.Append(ConstString("signed wchar_t").GetCString(), eBasicTypeSignedWChar);
+            g_type_map.Append(ConstString("unsigned wchar_t").GetCString(), eBasicTypeUnsignedWChar);
+            // "short"
+            g_type_map.Append(ConstString("short").GetCString(), eBasicTypeShort);
+            g_type_map.Append(ConstString("short int").GetCString(), eBasicTypeShort);
+            g_type_map.Append(ConstString("unsigned short").GetCString(), eBasicTypeUnsignedShort);
+            g_type_map.Append(ConstString("unsigned short int").GetCString(), eBasicTypeUnsignedShort);
+            
+            // "int"
+            g_type_map.Append(ConstString("int").GetCString(), eBasicTypeInt);
+            g_type_map.Append(ConstString("signed int").GetCString(), eBasicTypeInt);
+            g_type_map.Append(ConstString("unsigned int").GetCString(), eBasicTypeUnsignedInt);
+            g_type_map.Append(ConstString("unsigned").GetCString(), eBasicTypeUnsignedInt);
+            
+            // "long"
+            g_type_map.Append(ConstString("long").GetCString(), eBasicTypeLong);
+            g_type_map.Append(ConstString("long int").GetCString(), eBasicTypeLong);
+            g_type_map.Append(ConstString("unsigned long").GetCString(), eBasicTypeUnsignedLong);
+            g_type_map.Append(ConstString("unsigned long int").GetCString(), eBasicTypeUnsignedLong);
+            
+            // "long long"
+            g_type_map.Append(ConstString("long long").GetCString(), eBasicTypeLongLong);
+            g_type_map.Append(ConstString("long long int").GetCString(), eBasicTypeLongLong);
+            g_type_map.Append(ConstString("unsigned long long").GetCString(), eBasicTypeUnsignedLongLong);
+            g_type_map.Append(ConstString("unsigned long long int").GetCString(), eBasicTypeUnsignedLongLong);
+
+            // "int128"
+            g_type_map.Append(ConstString("__int128_t").GetCString(), eBasicTypeInt128);
+            g_type_map.Append(ConstString("__uint128_t").GetCString(), eBasicTypeUnsignedInt128);
+            
+            // Miscelaneous
+            g_type_map.Append(ConstString("bool").GetCString(), eBasicTypeBool);
+            g_type_map.Append(ConstString("float").GetCString(), eBasicTypeFloat);
+            g_type_map.Append(ConstString("double").GetCString(), eBasicTypeDouble);
+            g_type_map.Append(ConstString("long double").GetCString(), eBasicTypeLongDouble);
+            g_type_map.Append(ConstString("id").GetCString(), eBasicTypeObjCID);
+            g_type_map.Append(ConstString("SEL").GetCString(), eBasicTypeObjCSel);
+            g_type_map.Append(ConstString("nullptr").GetCString(), eBasicTypeNullPtr);
+            g_type_map.Sort();
+        });
+
+        return g_type_map.Find(name.GetCString(), eBasicTypeInvalid);
+    }
+    return eBasicTypeInvalid;
+}
+
+ClangASTType
+ClangASTType::GetBasicType (clang::ASTContext *ast, const ConstString &name)
+{
+    if (ast)
+    {
+        lldb::BasicType basic_type = ClangASTType::GetBasicTypeEnumeration (name);
+        return ClangASTType::GetBasicType (ast, basic_type);
+    }
+    return ClangASTType();
+}
+
+ClangASTType
+ClangASTType::GetBasicType (clang::ASTContext *ast, lldb::BasicType type)
+{
+    if (ast)
+    {
+        clang_type_t clang_type = NULL;
+        
+        switch (type)
+        {
+            case eBasicTypeInvalid:
+            case eBasicTypeOther:
+                break;
+            case eBasicTypeVoid:
+                clang_type = ast->VoidTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeChar:
+                clang_type = ast->CharTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeSignedChar:
+                clang_type = ast->SignedCharTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeUnsignedChar:
+                clang_type = ast->UnsignedCharTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeWChar:
+                clang_type = ast->getWCharType().getAsOpaquePtr();
+                break;
+            case eBasicTypeSignedWChar:
+                clang_type = ast->getSignedWCharType().getAsOpaquePtr();
+                break;
+            case eBasicTypeUnsignedWChar:
+                clang_type = ast->getUnsignedWCharType().getAsOpaquePtr();
+                break;
+            case eBasicTypeChar16:
+                clang_type = ast->Char16Ty.getAsOpaquePtr();
+                break;
+            case eBasicTypeChar32:
+                clang_type = ast->Char32Ty.getAsOpaquePtr();
+                break;
+            case eBasicTypeShort:
+                clang_type = ast->ShortTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeUnsignedShort:
+                clang_type = ast->UnsignedShortTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeInt:
+                clang_type = ast->IntTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeUnsignedInt:
+                clang_type = ast->UnsignedIntTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeLong:
+                clang_type = ast->LongTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeUnsignedLong:
+                clang_type = ast->UnsignedLongTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeLongLong:
+                clang_type = ast->LongLongTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeUnsignedLongLong:
+                clang_type = ast->UnsignedLongLongTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeInt128:
+                clang_type = ast->Int128Ty.getAsOpaquePtr();
+                break;
+            case eBasicTypeUnsignedInt128:
+                clang_type = ast->UnsignedInt128Ty.getAsOpaquePtr();
+                break;
+            case eBasicTypeBool:
+                clang_type = ast->BoolTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeHalf:
+                clang_type = ast->HalfTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeFloat:
+                clang_type = ast->FloatTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeDouble:
+                clang_type = ast->DoubleTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeLongDouble:
+                clang_type = ast->LongDoubleTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeFloatComplex:
+                clang_type = ast->FloatComplexTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeDoubleComplex:
+                clang_type = ast->DoubleComplexTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeLongDoubleComplex:
+                clang_type = ast->LongDoubleComplexTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeObjCID:
+                clang_type = ast->ObjCBuiltinIdTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeObjCClass:
+                clang_type = ast->ObjCBuiltinClassTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeObjCSel:
+                clang_type = ast->ObjCBuiltinSelTy.getAsOpaquePtr();
+                break;
+            case eBasicTypeNullPtr:
+                clang_type = ast->NullPtrTy.getAsOpaquePtr();
+                break;
+        }
+        
+        if (clang_type)
+            return ClangASTType (ast, clang_type);
+    }
+    return ClangASTType();
+}
+





More information about the lldb-commits mailing list