[Lldb-commits] [lldb] r220810 - When trying to get the element type of an array type, do not go to the canonical type, since that will strip typedefs where we want them to be preserved. Fixes rdar://15453076

Enrico Granata egranata at apple.com
Tue Oct 28 11:25:51 PDT 2014


Author: enrico
Date: Tue Oct 28 13:25:50 2014
New Revision: 220810

URL: http://llvm.org/viewvc/llvm-project?rev=220810&view=rev
Log:
When trying to get the element type of an array type, do not go to the canonical type, since that will strip typedefs where we want them to be preserved. Fixes rdar://15453076

Added:
    lldb/trunk/test/functionalities/data-formatter/typedef_array/
    lldb/trunk/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py
    lldb/trunk/test/functionalities/data-formatter/typedef_array/main.cpp
Modified:
    lldb/trunk/source/Symbol/ClangASTType.cpp

Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=220810&r1=220809&r2=220810&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Tue Oct 28 13:25:50 2014
@@ -3642,7 +3642,7 @@ ClangASTType::GetChildClangTypeAtIndex (
         case clang::Type::IncompleteArray:
             if (ignore_array_bounds || idx_is_valid)
             {
-                const clang::ArrayType *array = llvm::cast<clang::ArrayType>(parent_qual_type.getTypePtr());
+                const clang::ArrayType *array = GetQualType()->getAsArrayTypeUnsafe();
                 if (array)
                 {
                     ClangASTType element_type (m_ast, array->getElementType());

Added: lldb/trunk/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py?rev=220810&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py (added)
+++ lldb/trunk/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py Tue Oct 28 13:25:50 2014
@@ -0,0 +1,3 @@
+import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())

Added: lldb/trunk/test/functionalities/data-formatter/typedef_array/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/typedef_array/main.cpp?rev=220810&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/typedef_array/main.cpp (added)
+++ lldb/trunk/test/functionalities/data-formatter/typedef_array/main.cpp Tue Oct 28 13:25:50 2014
@@ -0,0 +1,14 @@
+//===-- main.cpp --------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+typedef int Foo;
+
+int main() {
+    Foo array[3] = {1,2,3};
+    return 0; //% self.expect("frame variable array --show-types --", substrs = ['(Foo [3]) array = {','(Foo) [0] = 1','(Foo) [1] = 2','(Foo) [2] = 3'])
+}





More information about the lldb-commits mailing list