summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Symbol/ClangASTType.h2
-rw-r--r--lldb/source/Symbol/ClangASTType.cpp12
2 files changed, 10 insertions, 4 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTType.h b/lldb/include/lldb/Symbol/ClangASTType.h
index ad980ce50c8..d3a98b95160 100644
--- a/lldb/include/lldb/Symbol/ClangASTType.h
+++ b/lldb/include/lldb/Symbol/ClangASTType.h
@@ -312,7 +312,7 @@ public:
clang::DeclContext *decl_ctx) const;
ClangASTType
- GetArrayElementType (uint64_t& stride) const;
+ GetArrayElementType (uint64_t *stride = nullptr) const;
ClangASTType
GetCanonicalType () const;
diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp
index cbaf36c89c5..98e7e818ad1 100644
--- a/lldb/source/Symbol/ClangASTType.cpp
+++ b/lldb/source/Symbol/ClangASTType.cpp
@@ -1638,16 +1638,22 @@ ClangASTType::AddVolatileModifier () const
}
ClangASTType
-ClangASTType::GetArrayElementType (uint64_t& stride) const
+ClangASTType::GetArrayElementType (uint64_t *stride) const
{
if (IsValid())
{
QualType qual_type(GetCanonicalQualType());
- ClangASTType element_type (m_ast, qual_type.getTypePtr()->getArrayElementTypeNoTypeQual()->getCanonicalTypeUnqualified());
+ const clang::Type *array_elem_type = qual_type.getTypePtr()->getArrayElementTypeNoTypeQual();
+
+ if (!array_elem_type)
+ return ClangASTType();
+
+ ClangASTType element_type (m_ast, array_elem_type->getCanonicalTypeUnqualified());
// TODO: the real stride will be >= this value.. find the real one!
- stride = element_type.GetByteSize();
+ if (stride)
+ *stride = element_type.GetByteSize();
return element_type;
OpenPOWER on IntegriCloud