summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2014-10-28 18:25:50 +0000
committerEnrico Granata <egranata@apple.com>2014-10-28 18:25:50 +0000
commit4f2fe82b6de2069ae48bd1e8df0e29826ad63351 (patch)
treeac81b8b482dae0c338acf96cf6ea365f6381e9ef
parent1cf354c92f560d6fd9bf1265b7c235a22f721db1 (diff)
downloadbcm5719-llvm-4f2fe82b6de2069ae48bd1e8df0e29826ad63351.tar.gz
bcm5719-llvm-4f2fe82b6de2069ae48bd1e8df0e29826ad63351.zip
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
llvm-svn: 220810
-rw-r--r--lldb/source/Symbol/ClangASTType.cpp2
-rw-r--r--lldb/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py3
-rw-r--r--lldb/test/functionalities/data-formatter/typedef_array/main.cpp14
3 files changed, 18 insertions, 1 deletions
diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp
index d8e053d0940..06de2ad7335 100644
--- a/lldb/source/Symbol/ClangASTType.cpp
+++ b/lldb/source/Symbol/ClangASTType.cpp
@@ -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
index 00000000000..a70d2ca7414
--- /dev/null
+++ b/lldb/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py
@@ -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
index 00000000000..649c1e09a6a
--- /dev/null
+++ b/lldb/test/functionalities/data-formatter/typedef_array/main.cpp
@@ -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'])
+}
OpenPOWER on IntegriCloud