Added some hardening to make sure that we don't

use QualType contents unchecked.

llvm-svn: 153201
This commit is contained in:
Sean Callanan 2012-03-21 17:13:20 +00:00
parent 3ba24bab1c
commit e2d4748ae3
2 changed files with 5 additions and 0 deletions

View File

@ -1349,6 +1349,8 @@ NameSearchContext::AddVarDecl(void *type)
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(),

View File

@ -2902,6 +2902,9 @@ ClangExpressionDeclMap::AddOneVariable (NameSearchContext &context, VariableSP v
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))