[Lldb-commits] [lldb] r270097 - Fixed a crash if a FunctionDecl couldn't be imported.
Sean Callanan via lldb-commits
lldb-commits at lists.llvm.org
Thu May 19 12:23:37 PDT 2016
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;
+ }
}
}
}
More information about the lldb-commits
mailing list