From 03a77e9a3909037e88d5479557a61275702b7f7c Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 21 Mar 2018 11:10:57 +0000 Subject: [PATCH] Fix crash exposed by r328025 The issue was that the ASTDumper was being passed a null pointer (because we did not create any declaration for the operator==). The crash was in logging code, so it only manifested it self if you ran the tests with logging enabled (like our bots do). Given that this is logging code and the rest of the debugger is fine with the declaration being null, I just make sure the logging code can handle it as well. Right now I just do the null check in ClangExpressionDeclMap, but if the ASTDumper class is meant to be a debugging/logging aid, then it might be a good idea move the check inside the class itself. llvm-svn: 328088 --- .../ExpressionParser/Clang/ClangExpressionDeclMap.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 07ff2e97aac7..8a39e720eaba 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -2116,7 +2116,8 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, parser_vars->m_llvm_value = NULL; if (log) { - ASTDumper ast_dumper(function_decl); + std::string function_str = + function_decl ? ASTDumper(function_decl).GetCString() : "nullptr"; StreamString ss; @@ -2127,7 +2128,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, log->Printf( " CEDM::FEVD[%u] Found %s function %s (description %s), returned %s", current_id, (function ? "specific" : "generic"), decl_name.c_str(), - ss.GetData(), ast_dumper.GetCString()); + ss.GetData(), function_str.c_str()); } }