[Lldb-commits] [lldb] r105868 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp

Greg Clayton gclayton at apple.com
Fri Jun 11 18:20:30 PDT 2010


Author: gclayton
Date: Fri Jun 11 20:20:30 2010
New Revision: 105868

URL: http://llvm.org/viewvc/llvm-project?rev=105868&view=rev
Log:
Anders Carlsson patch for member pointers. Thanks Anders.


Modified:
    lldb/trunk/include/lldb/Symbol/ClangASTContext.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=105868&r1=105867&r2=105868&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Jun 11 20:20:30 2010
@@ -343,6 +343,10 @@
     void *
     CreateRValueReferenceType (void * clang_type);
 
+    void *
+    CreateMemberPointerType (void * clang_pointee_type,
+                             void * clang_class_type);
+
     size_t
     GetPointerBitSize ();
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=105868&r1=105867&r2=105868&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Jun 11 20:20:30 2010
@@ -3123,7 +3123,49 @@
                 }
                 break;
 
+            case DW_TAG_ptr_to_member_type:
+                {
+                    dw_offset_t type_die_offset = DW_INVALID_OFFSET;
+                    dw_offset_t containing_type_die_offset = DW_INVALID_OFFSET;
+
+                    const size_t num_attributes = die->GetAttributes(this, dwarf_cu, attributes);
+                    
+                    if (num_attributes > 0) {
+                        uint32_t i;
+                        for (i=0; i<num_attributes; ++i)
+                        {
+                            attr = attributes.AttributeAtIndex(i);
+                            DWARFFormValue form_value;
+                            if (attributes.ExtractFormValueAtIndex(this, i, form_value))
+                            {
+                                switch (attr)
+                                {
+                                    case DW_AT_type:
+                                        type_die_offset = form_value.Reference(dwarf_cu); break;
+                                    case DW_AT_containing_type:
+                                        containing_type_die_offset = form_value.Reference(dwarf_cu); break;
+                                }
+                            }
+                        }
+                        
+                        Type *pointee_type = ResolveTypeUID(type_die_offset);
+                        Type *class_type = ResolveTypeUID(containing_type_die_offset);
+                        
+                        void *pointee_clang_type = pointee_type->GetOpaqueClangQualType();
+                        void *class_clang_type = pointee_type->GetOpaqueClangQualType();
+
+                        void *clang_type = type_list->GetClangASTContext().CreateMemberPointerType(pointee_clang_type, class_clang_type);
+
+                        size_t byte_size = ClangASTContext::GetTypeBitSize(type_list->GetClangASTContext().getASTContext(), clang_type) / 8;
+
+                        type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, NULL, clang_type));
+                        const_cast<DWARFDebugInfoEntry*>(die)->SetUserData(type_sp.get());
+                    }
+                                            
+                    break;
+                }
             default:
+                assert(false && "Unhandled type tag!");
                 break;
             }
 

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=105868&r1=105867&r2=105868&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Jun 11 20:20:30 2010
@@ -2165,6 +2165,15 @@
     return NULL;
 }
 
+void *
+ClangASTContext::CreateMemberPointerType (void * clang_pointee_type, void * clang_class_type)
+{
+    if (clang_pointee_type && clang_pointee_type)
+        return getASTContext()->getMemberPointerType(QualType::getFromOpaquePtr(clang_pointee_type),
+                                                     QualType::getFromOpaquePtr(clang_class_type).getTypePtr()).getAsOpaquePtr();
+    return NULL;
+}
+
 size_t
 ClangASTContext::GetPointerBitSize ()
 {





More information about the lldb-commits mailing list