When trying to get the element type of an array type, do not go to the canonical...
authorEnrico Granata <egranata@apple.com>
Tue, 28 Oct 2014 18:25:50 +0000 (18:25 +0000)
committerEnrico Granata <egranata@apple.com>
Tue, 28 Oct 2014 18:25:50 +0000 (18:25 +0000)
llvm-svn: 220810

lldb/source/Symbol/ClangASTType.cpp
lldb/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py [new file with mode: 0644]
lldb/test/functionalities/data-formatter/typedef_array/main.cpp [new file with mode: 0644]

index d8e053d..06de2ad 100644 (file)
@@ -3642,7 +3642,7 @@ ClangASTType::GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
         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());
diff --git a/lldb/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py b/lldb/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py
new file mode 100644 (file)
index 0000000..a70d2ca
--- /dev/null
@@ -0,0 +1,3 @@
+import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
diff --git a/lldb/test/functionalities/data-formatter/typedef_array/main.cpp b/lldb/test/functionalities/data-formatter/typedef_array/main.cpp
new file mode 100644 (file)
index 0000000..649c1e0
--- /dev/null
@@ -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'])
+}