[Lldb-commits] [lldb] 381e81a - [lldb][NFCI] Remove UserExpression::GetJITModule

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 30 23:23:10 PST 2020


Author: Alex Langford
Date: 2020-01-30T23:20:19-08:00
New Revision: 381e81a048f8cd6aab6a41c87ad1b1658f052192

URL: https://github.com/llvm/llvm-project/commit/381e81a048f8cd6aab6a41c87ad1b1658f052192
DIFF: https://github.com/llvm/llvm-project/commit/381e81a048f8cd6aab6a41c87ad1b1658f052192.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/include/lldb/Expression/LLVMUserExpression.h
    lldb/include/lldb/Expression/UserExpression.h
    lldb/source/Expression/LLVMUserExpression.cpp
    lldb/source/Expression/REPL.cpp
    lldb/source/Expression/UserExpression.cpp
    lldb/source/Target/Target.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Expression/LLVMUserExpression.h b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 2679c01a4e00..70ef12f15ced 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h
@@ -71,8 +71,6 @@ class LLVMUserExpression : public UserExpression {
   /// 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,

diff  --git a/lldb/include/lldb/Expression/UserExpression.h b/lldb/include/lldb/Expression/UserExpression.h
index 83122d8ba518..4ac20b2c2535 100644
--- a/lldb/include/lldb/Expression/UserExpression.h
+++ b/lldb/include/lldb/Expression/UserExpression.h
@@ -213,8 +213,6 @@ class UserExpression : public Expression {
     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 @@ class UserExpression : public Expression {
   ///     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 @@ class UserExpression : public Expression {
            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 =

diff  --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp
index 72b2c5d0ee09..d7958a50f9bb 100644
--- a/lldb/source/Expression/LLVMUserExpression.cpp
+++ b/lldb/source/Expression/LLVMUserExpression.cpp
@@ -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();
-}

diff  --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp
index d49b7644d7f6..8a1eb5d4e5c9 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -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();
 

diff  --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp
index b5af59729130..0cbcbe8e5107 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -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 &&

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 64913f937818..a8d4f24b1c72 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -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;


        


More information about the lldb-commits mailing list