[Lldb-commits] [lldb] [lldb] Get IRExecutionUnit mangling-mode from llvm::Module. (PR #224595)

Lang Hames via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 18 03:46:29 PDT 2026


https://github.com/lhames created https://github.com/llvm/llvm-project/pull/224595

Get the mangling mode (IRExecutionUnit::m_strip_underscore) from the llvm::Module at IRExecutionUnit construction time, rather than getting it from the llvm::ExecutionEngine in GetRunnableInfo.

This is a step towards decoupling IRExecutionUnit from llvm::ExecutionEngine / MCJIT.

>From 3221bc7a9bc93df13aa7d62cd45dff701bf28d2d Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at apple.com>
Date: Fri, 18 Sep 2026 18:15:57 +1000
Subject: [PATCH] [lldb] Get IRExecutionUnit mangling-mode from llvm::Module.

Get the mangling mode (IRExecutionUnit::m_strip_underscore) from the
llvm::Module at IRExecutionUnit construction time, rather than getting
it from the llvm::ExecutionEngine in GetRunnableInfo.

This is a step towards decoupling IRExecutionUnit from
llvm::ExecutionEngine / MCJIT.
---
 lldb/source/Expression/IRExecutionUnit.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index fe0c060184c6d..73874850addcb 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -55,6 +55,8 @@ IRExecutionUnit::IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_up,
       m_cpu_features(cpu_features), m_name(name), m_sym_ctx(sym_ctx),
       m_did_jit(false), m_function_load_addr(LLDB_INVALID_ADDRESS),
       m_function_end_load_addr(LLDB_INVALID_ADDRESS),
+      m_strip_underscore(
+          m_module_up ? m_module_up->getDataLayout().getGlobalPrefix() == '_' : false),
       m_reported_allocations(false), m_preferred_modules() {}
 
 lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size,
@@ -308,9 +310,6 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
     return;
   }
 
-  m_strip_underscore =
-      (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
-
   class ObjectDumper : public llvm::ObjectCache {
   public:
     ObjectDumper(FileSpec output_dir)  : m_out_dir(output_dir) {}



More information about the lldb-commits mailing list