diff options
author | Sean Callanan <scallanan@apple.com> | 2016-05-19 19:23:37 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2016-05-19 19:23:37 +0000 |
commit | 37e2664f304c25e5b69f4fb0a43ee3995455ac9e (patch) | |
tree | 544f6ac95aeb436db7b0450c7a66472b58850b96 | |
parent | c48a879ef880eec867c4f68c1fbe06767c8040dd (diff) | |
download | bcm5719-llvm-37e2664f304c25e5b69f4fb0a43ee3995455ac9e.tar.gz bcm5719-llvm-37e2664f304c25e5b69f4fb0a43ee3995455ac9e.zip |
Fixed a crash if a FunctionDecl couldn't be imported.
llvm-svn: 270097
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 4b398631fd4..a0d33f70dee 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -1503,9 +1503,12 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, { if (llvm::isa<clang::FunctionDecl>(decl)) { - clang::NamedDecl *copied_decl = llvm::cast<FunctionDecl>(m_ast_importer_sp->CopyDecl(m_ast_context, &decl->getASTContext(), decl)); - context.AddNamedDecl(copied_decl); - context.m_found.function_with_type_info = true; + clang::NamedDecl *copied_decl = llvm::cast_or_null<FunctionDecl>(m_ast_importer_sp->CopyDecl(m_ast_context, &decl->getASTContext(), decl)); + if (copied_decl) + { + context.AddNamedDecl(copied_decl); + context.m_found.function_with_type_info = true; + } } } } |