[Lldb-commits] [lldb] [lldb][ExpressionParser][NFCI] Add new DoPrepareForExecution interface to be implemented by language plugins (PR #96290)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 21 07:53:49 PDT 2024


================
@@ -0,0 +1,73 @@
+//===-- ExpressionParser.cpp ----------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Expression/ExpressionParser.h"
+#include "lldb/Expression/DiagnosticManager.h"
+#include "lldb/Expression/IRExecutionUnit.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/ThreadPlanCallFunction.h"
+
+using namespace lldb_private;
+
+Status ExpressionParser::PrepareForExecution(
+    lldb::addr_t &func_addr, lldb::addr_t &func_end,
+    std::shared_ptr<IRExecutionUnit> &execution_unit_sp,
+    ExecutionContext &exe_ctx, bool &can_interpret,
+    lldb_private::ExecutionPolicy execution_policy) {
+  Status status =
+      DoPrepareForExecution(func_addr, func_end, execution_unit_sp, exe_ctx,
+                            can_interpret, execution_policy);
+  if (status.Success() && exe_ctx.GetProcessPtr() && exe_ctx.HasThreadScope()) {
+    status = RunStaticInitializers(execution_unit_sp, exe_ctx);
+  }
+  return status;
+}
+
+Status ExpressionParser::RunStaticInitializers(
+    lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx) {
+  lldb_private::Status err;
----------------
JDevlieghere wrote:

Nit: Drop `lldb_private::`

https://github.com/llvm/llvm-project/pull/96290


More information about the lldb-commits mailing list