Author: spyffe Date: Thu May 19 14:23:37 2016 New Revision: 270097 URL: http://llvm.org/viewvc/llvm-project?rev=270097&view=rev Log: Fixed a crash if a FunctionDecl couldn't be imported.
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp?rev=270097&r1=270096&r2=270097&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp Thu May 19 14:23:37 2016 @@ -1503,9 +1503,12 @@ ClangExpressionDeclMap::FindExternalVisi { 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; + } } } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits