[Lldb-commits] [lldb] [LLDB] added getName method in SBModule (PR #150331)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 23 16:54:08 PDT 2025


================
@@ -671,3 +671,15 @@ void SBModule::GarbageCollectAllocatedModules() {
   const bool mandatory = false;
   ModuleList::RemoveOrphanSharedModules(mandatory);
 }
+
+const char *SBModule::GetName() const {
+  LLDB_INSTRUMENT_VA(this);
+  if (!m_opaque_sp) {
+    return nullptr;
+  }
+  auto mod_name = m_opaque_sp->GetObjectName();
+  if (!mod_name) {
+    return nullptr;
+  }
+  return mod_name.AsCString();
----------------
JDevlieghere wrote:

`AsCString` will return `nullptr` if the `ConstString` is empty, so the previous check is redundant.

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


More information about the lldb-commits mailing list