[lldb][NFCI] Remove UserExpression::GetJITModule

UserExpression::GetJITModule was used to support an option in
UserExpression::Evaluate that let you hold onto the JIT Module used during
the expression evaluation. This was only actually used in one spot --
REPL::IOHandlerInputComplete. That method didn't actually take use the
JIT module it got back, so this feature was not used in practice.
This means that we can delete the support in UserExpression::Evaluate
and delete the UserExpression::GetJITModule method entirely.
This commit is contained in:
Alex Langford 2020-01-30 23:16:12 -08:00
parent 22b044877d
commit 381e81a048
6 changed files with 10 additions and 32 deletions

View File

@ -71,8 +71,6 @@ public:
/// translation unit.
const char *Text() override { return m_transformed_text.c_str(); }
lldb::ModuleSP GetJITModule() override;
protected:
lldb::ExpressionResults
DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,

View File

@ -213,8 +213,6 @@ public:
return lldb::ExpressionVariableSP();
}
virtual lldb::ModuleSP GetJITModule() { return lldb::ModuleSP(); }
/// Evaluate one expression in the scratch context of the target passed in
/// the exe_ctx and return its result.
///
@ -244,9 +242,6 @@ public:
/// If non-nullptr, the fixed expression is copied into the provided
/// string.
///
/// \param[out] jit_module_sp_ptr
/// If non-nullptr, used to persist the generated IR module.
///
/// \param[in] ctx_obj
/// If specified, then the expression will be evaluated in the context of
/// this object. It means that the context object's address will be
@ -265,7 +260,6 @@ public:
llvm::StringRef expr_cstr, llvm::StringRef expr_prefix,
lldb::ValueObjectSP &result_valobj_sp, Status &error,
std::string *fixed_expression = nullptr,
lldb::ModuleSP *jit_module_sp_ptr = nullptr,
ValueObject *ctx_obj = nullptr);
static const Status::ValueType kNoResult =

View File

@ -357,8 +357,3 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression(
return true;
}
lldb::ModuleSP LLVMUserExpression::GetJITModule() {
if (m_execution_unit_sp)
return m_execution_unit_sp->GetJITModule();
return lldb::ModuleSP();
}

View File

@ -291,12 +291,10 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) {
const char *expr_prefix = nullptr;
lldb::ValueObjectSP result_valobj_sp;
Status error;
lldb::ModuleSP jit_module_sp;
lldb::ExpressionResults execution_results =
UserExpression::Evaluate(exe_ctx, expr_options, code.c_str(),
expr_prefix, result_valobj_sp, error,
nullptr, // Fixed Expression
&jit_module_sp);
nullptr); // fixed expression
// CommandInterpreter &ci = debugger.GetCommandInterpreter();

View File

@ -139,12 +139,12 @@ lldb::addr_t UserExpression::GetObjectPointer(lldb::StackFrameSP frame_sp,
return ret;
}
lldb::ExpressionResults UserExpression::Evaluate(
ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
llvm::StringRef expr, llvm::StringRef prefix,
lldb::ValueObjectSP &result_valobj_sp, Status &error,
std::string *fixed_expression, lldb::ModuleSP *jit_module_sp_ptr,
ValueObject *ctx_obj) {
lldb::ExpressionResults
UserExpression::Evaluate(ExecutionContext &exe_ctx,
const EvaluateExpressionOptions &options,
llvm::StringRef expr, llvm::StringRef prefix,
lldb::ValueObjectSP &result_valobj_sp, Status &error,
std::string *fixed_expression, ValueObject *ctx_obj) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
LIBLLDB_LOG_STEP));
@ -302,11 +302,6 @@ lldb::ExpressionResults UserExpression::Evaluate(
}
if (parse_success) {
// If a pointer to a lldb::ModuleSP was passed in, return the JIT'ed module
// if one was created
if (jit_module_sp_ptr)
*jit_module_sp_ptr = user_expression_sp->GetJITModule();
lldb::ExpressionVariableSP expr_result;
if (execution_policy == eExecutionPolicyNever &&

View File

@ -2356,11 +2356,9 @@ ExpressionResults Target::EvaluateExpression(
} else {
llvm::StringRef prefix = GetExpressionPrefixContents();
Status error;
execution_results =
UserExpression::Evaluate(exe_ctx, options, expr, prefix,
result_valobj_sp, error, fixed_expression,
nullptr, // Module
ctx_obj);
execution_results = UserExpression::Evaluate(exe_ctx, options, expr, prefix,
result_valobj_sp, error,
fixed_expression, ctx_obj);
}
return execution_results;