[Lldb-commits] [lldb] r180938 - <rdar://problem/13338477>

Enrico Granata egranata at apple.com
Thu May 2 11:54:55 PDT 2013


Author: enrico
Date: Thu May  2 13:54:54 2013
New Revision: 180938

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

clang sugarcoats expressions of the sort *(int (*)[3])foo where foo is an int* saying that their type class is Paren
This checkin updates our lookup tables to properly desugar Paren into the actual type of interest


Added:
    lldb/trunk/test/functionalities/data-formatter/rdar-13338477/
    lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Makefile
    lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Test-rdar-13338477.py
    lldb/trunk/test/functionalities/data-formatter/rdar-13338477/main.cpp
Modified:
    lldb/trunk/source/Symbol/ClangASTContext.cpp
    lldb/trunk/source/Symbol/ClangASTType.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=180938&r1=180937&r2=180938&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu May  2 13:54:54 2013
@@ -170,6 +170,9 @@ GetCompleteQualType (clang::ASTContext *
     case clang::Type::Elaborated:
         return GetCompleteQualType (ast, cast<ElaboratedType>(qual_type)->getNamedType(), allow_completion);
 
+    case clang::Type::Paren:
+        return GetCompleteQualType (ast, cast<ParenType>(qual_type)->desugar(), allow_completion);
+
     default:
         break;
     }
@@ -1454,6 +1457,9 @@ ClangASTContext::SetHasExternalStorage (
     case clang::Type::Elaborated:
         return ClangASTContext::SetHasExternalStorage (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), has_extern);
 
+    case clang::Type::Paren:
+        return ClangASTContext::SetHasExternalStorage (cast<ParenType>(qual_type)->desugar().getAsOpaquePtr(), has_extern);
+
     default:
         break;
     }
@@ -2865,6 +2871,9 @@ ClangASTContext::GetNumTemplateArguments
             case clang::Type::Elaborated:
                 return ClangASTContext::GetNumTemplateArguments (ast, cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
 
+            case clang::Type::Paren:
+                return ClangASTContext::GetNumTemplateArguments(ast, cast<ParenType>(qual_type)->desugar().getAsOpaquePtr());
+                
             default:
                 break;
         }
@@ -2941,6 +2950,9 @@ ClangASTContext::GetTemplateArgument (cl
 
             case clang::Type::Elaborated:
                 return ClangASTContext::GetTemplateArgument (ast, cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), arg_idx, kind);
+               
+            case clang::Type::Paren:
+                return ClangASTContext::GetTemplateArgument(ast, cast<ParenType>(qual_type)->desugar().getAsOpaquePtr(), arg_idx, kind);
                 
             default:
                 break;
@@ -3065,6 +3077,12 @@ ClangASTContext::GetTypeInfo
         return ClangASTContext::GetTypeInfo (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
                                              ast, 
                                              pointee_or_element_clang_type);
+
+    case clang::Type::Paren:
+        return ClangASTContext::GetTypeInfo(llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                            ast,
+                                            pointee_or_element_clang_type);
+
     case clang::Type::FunctionProto:                    return eTypeIsFuncPrototype | eTypeHasValue;
     case clang::Type::FunctionNoProto:                  return eTypeIsFuncPrototype | eTypeHasValue;
     case clang::Type::InjectedClassName:                return 0;
@@ -3155,7 +3173,8 @@ ClangASTContext::IsAggregateType (clang_
         return ClangASTContext::IsAggregateType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
     case clang::Type::Typedef:
         return ClangASTContext::IsAggregateType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
-
+    case clang::Type::Paren:
+        return ClangASTContext::IsAggregateType (cast<ParenType>(qual_type)->desugar().getAsOpaquePtr());
     default:
         break;
     }
@@ -3333,6 +3352,12 @@ ClangASTContext::GetNumChildren (clang::
                                                         omit_empty_base_classes);
         break;
 
+    case clang::Type::Paren:
+        num_children = ClangASTContext::GetNumChildren(ast,
+                                                       llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                                       omit_empty_base_classes);
+
+        break;
     default:
         break;
     }
@@ -3383,6 +3408,9 @@ ClangASTContext::GetNumDirectBaseClasses
             count = ClangASTContext::GetNumDirectBaseClasses (ast, cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
             break;
             
+        case clang::Type::Paren:
+            return ClangASTContext::GetNumDirectBaseClasses(ast, cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
+            
         default:
             break;
     }
@@ -3418,6 +3446,10 @@ ClangASTContext::GetNumVirtualBaseClasse
             count = ClangASTContext::GetNumVirtualBaseClasses (ast, cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
             break;
             
+        case clang::Type::Paren:
+            count = ClangASTContext::GetNumVirtualBaseClasses(ast, cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
+            break;
+
         default:
             break;
     }
@@ -3462,6 +3494,10 @@ ClangASTContext::GetNumFields (clang::AS
             count = ClangASTContext::GetNumFields (ast, cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
             break;
             
+        case clang::Type::Paren:
+            count = ClangASTContext::GetNumFields(ast, cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
+            break;
+            
         case clang::Type::ObjCObject:
         case clang::Type::ObjCInterface:
             if (GetCompleteQualType (ast, qual_type))
@@ -3562,6 +3598,12 @@ ClangASTContext::GetDirectBaseClassAtInd
                                                                 idx,
                                                                 bit_offset_ptr);
             
+        case clang::Type::Paren:
+            return  ClangASTContext::GetDirectBaseClassAtIndex (ast,
+                                                                cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                                                idx,
+                                                                bit_offset_ptr);
+            
         default:
             break;
     }
@@ -3621,6 +3663,12 @@ ClangASTContext::GetVirtualBaseClassAtIn
                                                                  idx,
                                                                  bit_offset_ptr);
             
+        case clang::Type::Paren:
+            return  ClangASTContext::GetVirtualBaseClassAtIndex (ast,
+                                                                 cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                                                 idx,
+                                                                 bit_offset_ptr);
+
         default:
             break;
     }
@@ -3771,6 +3819,15 @@ ClangASTContext::GetFieldAtIndex (clang:
                                                       bitfield_bit_size_ptr,
                                                       is_bitfield_ptr);
             
+        case clang::Type::Paren:
+            return  ClangASTContext::GetFieldAtIndex (ast,
+                                                      cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                                      idx,
+                                                      name,
+                                                      bit_offset_ptr,
+                                                      bitfield_bit_size_ptr,
+                                                      is_bitfield_ptr);
+            
         default:
             break;
     }
@@ -3950,7 +4007,7 @@ ClangASTContext::GetNumPointeeChildren (
     case clang::Type::FunctionProto:            return 0;   // When we function pointers, they have no children...
     case clang::Type::FunctionNoProto:          return 0;   // When we function pointers, they have no children...
     case clang::Type::UnresolvedUsing:          return 0;
-    case clang::Type::Paren:                    return 0;
+    case clang::Type::Paren:                    return ClangASTContext::GetNumPointeeChildren (cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
     case clang::Type::Typedef:                  return ClangASTContext::GetNumPointeeChildren (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
     case clang::Type::Elaborated:               return ClangASTContext::GetNumPointeeChildren (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
     case clang::Type::TypeOfExpr:               return 0;
@@ -4494,7 +4551,25 @@ ClangASTContext::GetChildClangTypeAtInde
                                          child_bitfield_bit_size,
                                          child_bitfield_bit_offset,
                                          child_is_base_class,
-                                         child_is_deref_of_parent); 
+                                         child_is_deref_of_parent);
+            
+    case clang::Type::Paren:
+        return GetChildClangTypeAtIndex (exe_ctx,
+                                         ast,
+                                         parent_name,
+                                         llvm::cast<clang::ParenType>(parent_qual_type)->desugar().getAsOpaquePtr(),
+                                         idx,
+                                         transparent_pointers,
+                                         omit_empty_base_classes,
+                                         ignore_array_bounds,
+                                         child_name,
+                                         child_byte_size,
+                                         child_byte_offset,
+                                         child_bitfield_bit_size,
+                                         child_bitfield_bit_offset,
+                                         child_is_base_class,
+                                         child_is_deref_of_parent);
+
 
     default:
         break;
@@ -4945,6 +5020,13 @@ ClangASTContext::GetIndexOfChildMemberWi
                                                   name,
                                                   omit_empty_base_classes,
                                                   child_indexes);
+                
+        case clang::Type::Paren:
+            return GetIndexOfChildMemberWithName (ast,
+                                                  cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                                  name,
+                                                  omit_empty_base_classes,
+                                                  child_indexes);
 
         default:
             break;
@@ -5159,6 +5241,12 @@ ClangASTContext::GetIndexOfChildWithName
                                             name,
                                             omit_empty_base_classes);
 
+        case clang::Type::Paren:
+            return GetIndexOfChildWithName (ast,
+                                            cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                            name,
+                                            omit_empty_base_classes);
+
         case clang::Type::Typedef:
             return GetIndexOfChildWithName (ast,
                                             cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
@@ -5235,6 +5323,7 @@ ClangASTContext::GetDeclContextForType (
     case clang::Type::Enum:                     return cast<EnumType>(qual_type)->getDecl();
     case clang::Type::Typedef:                  return ClangASTContext::GetDeclContextForType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
     case clang::Type::Elaborated:               return ClangASTContext::GetDeclContextForType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
+    case clang::Type::Paren:                    return ClangASTContext::GetDeclContextForType (cast<ParenType>(qual_type)->desugar().getAsOpaquePtr());
     case clang::Type::TypeOfExpr:               break;
     case clang::Type::TypeOf:                   break;
     case clang::Type::Decltype:                 break;
@@ -5246,7 +5335,6 @@ ClangASTContext::GetDeclContextForType (
     case clang::Type::SubstTemplateTypeParmPack:break;
     case clang::Type::PackExpansion:            break;
     case clang::Type::UnresolvedUsing:          break;
-    case clang::Type::Paren:                    break;
     case clang::Type::Attributed:               break;
     case clang::Type::Auto:                     break;
     case clang::Type::InjectedClassName:        break;
@@ -5827,7 +5915,13 @@ ClangASTContext::IsPossibleDynamicType (
                                                                dynamic_pointee_type,
                                                                check_cplusplus,
                                                                check_objc);
-            
+
+            case clang::Type::Paren:
+                return ClangASTContext::IsPossibleDynamicType (ast,
+                                                               cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                                               dynamic_pointee_type,
+                                                               check_cplusplus,
+                                                               check_objc);
             default:
                 break;
         }
@@ -5983,6 +6077,9 @@ ClangASTContext::IsReferenceType (clang_
         return ClangASTContext::IsReferenceType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
     case clang::Type::Elaborated:
         return ClangASTContext::IsReferenceType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
+    case clang::Type::Paren:
+        return ClangASTContext::IsReferenceType (cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
+
     default:
         break;
     }
@@ -6038,6 +6135,8 @@ ClangASTContext::IsPointerOrReferenceTyp
         return ClangASTContext::IsPointerOrReferenceType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
     case clang::Type::Elaborated:
         return ClangASTContext::IsPointerOrReferenceType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
+    case clang::Type::Paren:
+        return ClangASTContext::IsPointerOrReferenceType (cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
     default:
         break;
     }
@@ -6107,6 +6206,8 @@ ClangASTContext::IsPointerType (clang_ty
             return ClangASTContext::IsPointerType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), target_type);
         case clang::Type::Elaborated:
             return ClangASTContext::IsPointerType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), target_type);
+        case clang::Type::Paren:
+            return ClangASTContext::IsPointerType (cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(), target_type);
         default:
             break;
         }
@@ -6354,6 +6455,8 @@ ClangASTContext::IsFunctionPointerType (
             return ClangASTContext::IsFunctionPointerType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
         case clang::Type::Elaborated:
             return ClangASTContext::IsFunctionPointerType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
+        case clang::Type::Paren:
+            return ClangASTContext::IsFunctionPointerType (cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
 
         case clang::Type::LValueReference:
         case clang::Type::RValueReference:
@@ -6390,6 +6493,9 @@ ClangASTContext::GetArraySize (clang_typ
             
         case clang::Type::Elaborated:
             return ClangASTContext::GetArraySize(cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
+
+        case clang::Type::Paren:
+            return ClangASTContext::GetArraySize(cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
                 
         default:
             break;
@@ -6455,6 +6561,11 @@ ClangASTContext::GetAsArrayType (clang_t
                                                 member_type,
                                                 size,
                                                 is_incomplete);
+    case clang::Type::Paren:
+        return ClangASTContext::GetAsArrayType (cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                                member_type,
+                                                size,
+                                                is_incomplete);
     }
     return 0;
 }

Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=180938&r1=180937&r2=180938&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Thu May  2 13:54:54 2013
@@ -251,7 +251,8 @@ ClangASTType::GetTypeClass (clang::ASTCo
         case clang::Type::Enum:                     return lldb::eTypeClassEnumeration;
         case clang::Type::Typedef:                  return lldb::eTypeClassTypedef;
         case clang::Type::UnresolvedUsing:          break;
-        case clang::Type::Paren:                    break;
+        case clang::Type::Paren:
+            return ClangASTType::GetTypeClass (ast_context, llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
         case clang::Type::Elaborated:
             return ClangASTType::GetTypeClass (ast_context, llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
 
@@ -464,10 +465,12 @@ ClangASTType::GetEncoding (clang_type_t
     case clang::Type::Elaborated:
         return ClangASTType::GetEncoding (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), count);
 
+    case clang::Type::Paren:
+        return ClangASTType::GetEncoding (llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(), count);
+            
     case clang::Type::DependentSizedArray:
     case clang::Type::DependentSizedExtVector:
     case clang::Type::UnresolvedUsing:
-    case clang::Type::Paren:
     case clang::Type::Attributed:
     case clang::Type::TemplateTypeParm:
     case clang::Type::SubstTemplateTypeParm:
@@ -519,7 +522,7 @@ ClangASTType::GetFormat (clang_type_t cl
         break;
 
     case clang::Type::ConstantArray:
-        break;
+        return lldb::eFormatVoid; // no value
 
     case clang::Type::ExtVector:
     case clang::Type::Vector:
@@ -597,12 +600,13 @@ ClangASTType::GetFormat (clang_type_t cl
         return ClangASTType::GetFormat(llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
     case clang::Type::Auto:
         return ClangASTType::GetFormat(llvm::cast<clang::AutoType>(qual_type)->desugar().getAsOpaquePtr());
+    case clang::Type::Paren:
+        return ClangASTType::GetFormat(llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
     case clang::Type::Elaborated:
         return ClangASTType::GetFormat(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
     case clang::Type::DependentSizedArray:
     case clang::Type::DependentSizedExtVector:
     case clang::Type::UnresolvedUsing:
-    case clang::Type::Paren:
     case clang::Type::Attributed:
     case clang::Type::TemplateTypeParm:
     case clang::Type::SubstTemplateTypeParm:
@@ -950,6 +954,31 @@ ClangASTType::DumpValue
                               depth);             // Scope depth for any types that have children
         }
         break;
+            
+    case clang::Type::Paren:
+    {
+        clang::QualType desugar_qual_type = llvm::cast<clang::ParenType>(qual_type)->desugar();
+        lldb::Format desugar_format = ClangASTType::GetFormat(desugar_qual_type.getAsOpaquePtr());
+        std::pair<uint64_t, unsigned> desugar_type_info = ast_context->getTypeInfo(desugar_qual_type);
+        uint64_t desugar_byte_size = desugar_type_info.first / 8;
+        
+        return DumpValue (ast_context,        // The clang AST context for this type
+                          desugar_qual_type.getAsOpaquePtr(),    // The clang type we want to dump
+                          exe_ctx,
+                          s,                  // Stream to dump to
+                          desugar_format,  // The format with which to display the element
+                          data,               // Data buffer containing all bytes for this type
+                          data_byte_offset,   // Offset into "data" where to grab value from
+                          desugar_byte_size,  // Size of this type in bytes
+                          bitfield_bit_size,  // Bitfield bit size
+                          bitfield_bit_offset,// Bitfield bit offset
+                          show_types,         // Boolean indicating if we should show the variable types
+                          show_summary,       // Boolean indicating if we should show a summary for the current type
+                          verbose,            // Verbose output?
+                          depth);             // Scope depth for any types that have children
+    }
+        break;
+
     default:
         // We are down the a scalar type that we just need to display.
         data.Dump(s, data_byte_offset, format, data_byte_size, 1, UINT32_MAX, LLDB_INVALID_ADDRESS, bitfield_bit_size, bitfield_bit_offset);
@@ -1390,6 +1419,12 @@ ClangASTType::DumpTypeDescription (clang
                                  s);
             return;
 
+        case clang::Type::Paren:
+            DumpTypeDescription (ast_context,
+                                 llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
+                                 s);
+            return;
+
         case clang::Type::Record:
             {
                 ClangASTContext::GetCompleteType (ast_context, clang_type);

Added: lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Makefile?rev=180938&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Makefile (added)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Makefile Thu May  2 13:54:54 2013
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Test-rdar-13338477.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Test-rdar-13338477.py?rev=180938&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Test-rdar-13338477.py (added)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-13338477/Test-rdar-13338477.py Thu May  2 13:54:54 2013
@@ -0,0 +1,70 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+
+class Radar13338477DataFormatterTestCase(TestBase):
+
+    # test for rdar://problem/13338477 ()
+    mydir = os.path.join("functionalities", "data-formatter", "rdar-13338477")
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_with_dsym_and_run_command(self):
+        """Test that LLDB handles the clang typeclass Paren correctly."""
+        self.buildDsym()
+        self.data_formatter_commands()
+
+    @dwarf_test
+    def test_with_dwarf_and_run_command(self):
+        """Test that LLDB handles the clang typeclass Paren correctly."""
+        self.buildDwarf()
+        self.data_formatter_commands()
+
+    def setUp(self):
+        # Call super's setUp().
+        TestBase.setUp(self)
+        # Find the line number to break at.
+        self.line = line_number('main.cpp', '// Set break point at this line.')
+
+    def data_formatter_commands(self):
+        """Test that LLDB handles the clang typeclass Paren correctly."""
+        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # The stop reason of the thread should be breakpoint.
+        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            substrs = ['stopped',
+                       'stop reason = breakpoint'])
+
+        # This is the function to remove the custom formats in order to have a
+        # clean slate for the next test case.
+        def cleanup():
+            self.runCmd('type format delete hex', check=False)
+            self.runCmd('type summary clear', check=False)
+
+        # Execute the cleanup function during test case tear down.
+        self.addTearDownHook(cleanup)
+
+        self.expect('p *(int (*)[3])foo',
+            substrs = ['(int [3]) $',' = {','[0] = 1','[1] = 2','[2] = 3'])
+
+        self.expect('p *(int (*)[3])foo', matching=False,
+            substrs = ['01 00 00 00 02 00 00 00 03 00 00 00'])
+        self.expect('p *(int (*)[3])foo', matching=False,
+            substrs = ['0x000000030000000200000001'])
+
+
+if __name__ == '__main__':
+    import atexit
+    lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
+    unittest2.main()

Added: lldb/trunk/test/functionalities/data-formatter/rdar-13338477/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-13338477/main.cpp?rev=180938&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-13338477/main.cpp (added)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-13338477/main.cpp Thu May  2 13:54:54 2013
@@ -0,0 +1,17 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+void bar(int const *foo) {
+  __builtin_trap(); // Set break point at this line.
+}
+
+int main() {
+  int foo[] = {1,2,3};
+  bar(foo);
+}





More information about the lldb-commits mailing list