[Lldb-commits] [lldb] r228771 - Fixed a crasher that could happen if:

Greg Clayton gclayton at apple.com
Tue Feb 10 16:04:34 PST 2015

Author: gclayton
Date: Tue Feb 10 18:04:33 2015
New Revision: 228771

URL: http://llvm.org/viewvc/llvm-project?rev=228771&view=rev
Fixed a crasher that could happen if:
- you have a type that contains a typedef to a VectorType or an ExtVectorType
- that type is returned from an ARM function that LLDB steps over so we try to figure out the return type
- we try to determine if the type is a homogeneous aggregate type and we crash

We get not using getAs() when we should have been and using llvm::cast caused an assertion crash when the typedef type didn't return a valid VectorType or ExtVectorType.



Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=228771&r1=228770&r2=228771&view=diff
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Tue Feb 10 18:04:33 2015
@@ -493,7 +493,7 @@ ClangASTType::IsHomogeneousAggregate (Cl
                             else if (field_qual_type->isVectorType() || field_qual_type->isExtVectorType())
-                                const clang::VectorType *array = llvm::cast<clang::VectorType>(field_qual_type.getTypePtr());
+                                const clang::VectorType *array = field_qual_type.getTypePtr()->getAs<clang::VectorType>();
                                 if (array && array->getNumElements() <= 4)
                                     if (num_fields == 0)

More information about the lldb-commits mailing list