Added some hardening to make sure that we don't
use QualType contents unchecked.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153201 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangASTSource.cpp b/source/Expression/ClangASTSource.cpp
index d50e808..08f63b5 100644
--- a/source/Expression/ClangASTSource.cpp
+++ b/source/Expression/ClangASTSource.cpp
@@ -1349,6 +1349,8 @@
clang::NamedDecl *
NameSearchContext::AddFunDecl (void *type)
{
+ assert (type && "Type for variable must be non-NULL!");
+
clang::FunctionDecl *func_decl = FunctionDecl::Create (*m_ast_source.m_ast_context,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index ccb5266..dd6a80b 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -2902,6 +2902,9 @@
clang::QualType parser_opaque_type = QualType::getFromOpaquePtr(pt.GetOpaqueQualType());
+ if (parser_opaque_type.isNull())
+ return;
+
if (const clang::Type *parser_type = parser_opaque_type.getTypePtr())
{
if (const TagType *tag_type = dyn_cast<TagType>(parser_type))