[Lldb-commits] [lldb] r193818 - Further fixes to the dynamic type system prompted by ObjCDataFormatterTestCase.test_nserror_with_dsym_and_run_command

Enrico Granata egranata at apple.com
Thu Oct 31 15:42:01 PDT 2013


Author: enrico
Date: Thu Oct 31 17:42:00 2013
New Revision: 193818

URL: http://llvm.org/viewvc/llvm-project?rev=193818&view=rev
Log:
Further fixes to the dynamic type system prompted by ObjCDataFormatterTestCase.test_nserror_with_dsym_and_run_command

Modified:
    lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
    lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
    lldb/trunk/source/Symbol/ClangASTType.cpp
    lldb/trunk/source/Symbol/Type.cpp

Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=193818&r1=193817&r2=193818&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Thu Oct 31 17:42:00 2013
@@ -69,10 +69,10 @@ ValueObjectDynamicValue::GetTypeName()
     const bool success = UpdateValueIfNeeded(false);
     if (success)
     {
-        if (m_dynamic_type_info.HasType())
-            return GetClangType().GetConstTypeName();
         if (m_dynamic_type_info.HasName())
             return m_dynamic_type_info.GetName();
+        if (m_dynamic_type_info.HasType())
+            return GetClangType().GetConstTypeName();
     }
     return m_parent->GetTypeName();
 }
@@ -94,10 +94,10 @@ ValueObjectDynamicValue::GetQualifiedTyp
     const bool success = UpdateValueIfNeeded(false);
     if (success)
     {
-        if (m_dynamic_type_info.HasType())
-            return GetClangType().GetConstQualifiedTypeName ();
         if (m_dynamic_type_info.HasName())
             return m_dynamic_type_info.GetName();
+        if (m_dynamic_type_info.HasType())
+            return GetClangType().GetConstQualifiedTypeName ();
     }
     return m_parent->GetTypeName();
 }
@@ -155,6 +155,8 @@ FixupTypeAndOrName (const TypeAndOrName&
             corrected_name.append(" *");
         else if (parent.IsPointerOrReferenceType())
             corrected_name.append(" &");
+        // the parent type should be a correctly pointer'ed or referenc'ed type
+        ret.SetClangASTType(parent.GetClangType());
         ret.SetName(corrected_name.c_str());
     }
     return ret;

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=193818&r1=193817&r2=193818&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Thu Oct 31 17:42:00 2013
@@ -422,8 +422,7 @@ ValueObjectPrinter::ShouldPrintChildren
                 curr_ptr_depth = 1;
             }
             
-            if (curr_ptr_depth == 0)
-                return false;
+            return (curr_ptr_depth > 0);
         }
         
         TypeSummaryImpl* entry = GetSummaryFormatter();

Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=193818&r1=193817&r2=193818&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Thu Oct 31 17:42:00 2013
@@ -293,12 +293,17 @@ ClangASTType::IsRuntimeGeneratedType ()
 {
     if (!IsValid())
         return false;
+    
     clang::DeclContext* decl_ctx = GetDeclContextForType();
     if (!decl_ctx)
         return false;
-    if (!llvm::isa<ObjCContainerDecl>(decl_ctx))
+
+    if (!llvm::isa<clang::ObjCInterfaceDecl>(decl_ctx))
         return false;
-    ClangASTMetadata* ast_metadata = ClangASTContext::GetMetadata(m_ast, decl_ctx);
+    
+    clang::ObjCInterfaceDecl *result_iface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl_ctx);
+    
+    ClangASTMetadata* ast_metadata = ClangASTContext::GetMetadata(m_ast, result_iface_decl);
     if (!ast_metadata)
         return false;
     return (ast_metadata->GetISAPtr() != 0);

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=193818&r1=193817&r2=193818&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Thu Oct 31 17:42:00 2013
@@ -855,11 +855,12 @@ TypeAndOrName::operator!=(const TypeAndO
 
 ConstString
 TypeAndOrName::GetName () const
-{    
+{
+    if (m_type_name)
+        return m_type_name;
     if (m_type_pair)
         return m_type_pair.GetName();
-    else
-        return m_type_name;
+    return ConstString("<invalid>");
 }
 
 void





More information about the lldb-commits mailing list