diff options
| author | Jim Ingham <jingham@apple.com> | 2018-10-16 21:58:40 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2018-10-16 21:58:40 +0000 |
| commit | b1ecc3cac29bdae5469e9610a1ff66f8531a503c (patch) | |
| tree | 751f36f01bfa8eda4e6eb963c57fd0eb8f46d1f9 /lldb/source | |
| parent | d33f6e73e148b0a257facb81f100b1e731e0c910 (diff) | |
| download | bcm5719-llvm-b1ecc3cac29bdae5469e9610a1ff66f8531a503c.tar.gz bcm5719-llvm-b1ecc3cac29bdae5469e9610a1ff66f8531a503c.zip | |
Return a named error in the result object of an expression with no result
Before we returned an error that was not exposed in the SB API and no useful
error message. This change returns eExpressionProducedNoResult and an
appropriate error string.
<rdar://problem/44539514>
Differential Revision: https://reviews.llvm.org/D53309
llvm-svn: 344647
Diffstat (limited to 'lldb/source')
5 files changed, 11 insertions, 6 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index ac440ef0af5..f6e40075f9e 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -487,7 +487,7 @@ bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr, } } else { if (result_valobj_sp->GetError().GetError() == - UserExpression::kNoResult) { + lldb::eExpressionProducedNoResult) { if (format != eFormatVoid && m_interpreter.GetDebugger().GetNotifyVoid()) { error_stream->PutCString("(void)\n"); diff --git a/lldb/source/Expression/ExpressionSourceCode.cpp b/lldb/source/Expression/ExpressionSourceCode.cpp index abbb332fac4..2c8f77bb2df 100644 --- a/lldb/source/Expression/ExpressionSourceCode.cpp +++ b/lldb/source/Expression/ExpressionSourceCode.cpp @@ -256,7 +256,7 @@ bool ExpressionSourceCode::GetText(std::string &text, } ConstString object_name; - if (Language::LanguageIsCPlusPlus(frame->GetLanguage())) { + if (1 /* Language::LanguageIsCPlusPlus(frame->GetLanguage())*/) { if (target->GetInjectLocalVariables(&exe_ctx)) { lldb::VariableListSP var_list_sp = frame->GetInScopeVariableList(false, true); diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp index 50d4a09b636..c29004c8252 100644 --- a/lldb/source/Expression/REPL.cpp +++ b/lldb/source/Expression/REPL.cpp @@ -325,7 +325,7 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) { if (result_valobj_sp->GetError().Success()) { handled |= PrintOneVariable(debugger, output_sp, result_valobj_sp); } else if (result_valobj_sp->GetError().GetError() == - UserExpression::kNoResult) { + lldb::eExpressionProducedNoResult) { if (format != lldb::eFormatVoid && debugger.GetNotifyVoid()) { error_sp->PutCString("(void)\n"); handled = true; diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp index 34945fdcbfa..1477bbdb660 100644 --- a/lldb/source/Expression/UserExpression.cpp +++ b/lldb/source/Expression/UserExpression.cpp @@ -151,6 +151,9 @@ lldb::ExpressionResults UserExpression::Evaluate( ? UserExpression::eResultTypeId : UserExpression::eResultTypeAny; lldb::ExpressionResults execution_results = lldb::eExpressionSetupError; + + static const char *no_result_error = "Expression completed successfully " + "but had no result"; Target *target = exe_ctx.GetTargetPtr(); if (!target) { @@ -304,7 +307,8 @@ lldb::ExpressionResults UserExpression::Evaluate( error.SetExpressionError(lldb::eExpressionSetupError, "expression needed to run but couldn't"); } else if (execution_policy == eExecutionPolicyTopLevel) { - error.SetError(UserExpression::kNoResult, lldb::eErrorTypeGeneric); + error.SetExpressionError(lldb::eExpressionProducedNoResult, + no_result_error); return lldb::eExpressionCompleted; } else { if (options.InvokeCancelCallback(lldb::eExpressionEvaluationExecution)) { @@ -349,7 +353,8 @@ lldb::ExpressionResults UserExpression::Evaluate( log->Printf("== [UserExpression::Evaluate] Execution completed " "normally with no result =="); - error.SetError(UserExpression::kNoResult, lldb::eErrorTypeGeneric); + error.SetExpressionError(lldb::eExpressionProducedNoResult, + no_result_error); } } } diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 5961e6ab216..5e3ba245006 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -1758,7 +1758,7 @@ bool RenderScriptRuntime::EvalRSExpression(const char *expr, if (!expr_result->GetError().Success()) { Status err = expr_result->GetError(); // Expression returned is void, so this is actually a success - if (err.GetError() == UserExpression::kNoResult) { + if (err.GetError() == lldb::eExpressionProducedNoResult) { if (log) log->Printf("%s - expression returned void.", __FUNCTION__); |

