summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-03-20 21:11:12 +0000
committerSean Callanan <scallanan@apple.com>2012-03-20 21:11:12 +0000
commit61b33f7464b142fae2d3a8e35de93dded80d4c2b (patch)
tree70c93d00a8fb0088eef06f8d8f758f5e862951a0
parent3546559863871b7b9901ba2b5c4c4e65ec68cddd (diff)
downloadbcm5719-llvm-61b33f7464b142fae2d3a8e35de93dded80d4c2b.tar.gz
bcm5719-llvm-61b33f7464b142fae2d3a8e35de93dded80d4c2b.zip
Fixed some potential null-pointer bugs in the
expression parser code. llvm-svn: 153128
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index bfe876d0fa1..d50e80854e2 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -387,6 +387,9 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, original_ctx, decl);
+ if (!copied_decl)
+ continue;
+
if (FieldDecl *copied_field = dyn_cast<FieldDecl>(copied_decl))
{
QualType copied_field_type = copied_field->getType();
@@ -1291,6 +1294,9 @@ ClangASTSource::AddNamespace (NameSearchContext &context, ClangASTImporter::Name
Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, namespace_decl.GetASTContext(), namespace_decl.GetNamespaceDecl());
+ if (!copied_decl)
+ return NULL;
+
NamespaceDecl *copied_namespace_decl = dyn_cast<NamespaceDecl>(copied_decl);
m_ast_importer->RegisterNamespaceMap(copied_namespace_decl, namespace_decls);
@@ -1311,7 +1317,7 @@ ClangASTSource::GuardedCopyType (ASTContext *dest_context,
SetImportInProgress(false);
- if (ret_qual_type->getCanonicalTypeInternal().isNull())
+ if (ret && ret_qual_type->getCanonicalTypeInternal().isNull())
// this shouldn't happen, but we're hardening because the AST importer seems to be generating bad types
// on occasion.
return NULL;
OpenPOWER on IntegriCloud