[Lldb-commits] [lldb] [LLDB] Optimize identifier lookup in DIL (PR #146094)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 30 01:22:22 PDT 2025


================
@@ -129,28 +71,22 @@ lldb::ValueObjectSP LookupGlobalIdentifier(
   target_sp->GetImages().FindGlobalVariables(
       ConstString(name_ref), std::numeric_limits<uint32_t>::max(),
       modules_var_list);
-  if (modules_var_list.Empty())
-    return nullptr;
 
-  for (const lldb::VariableSP &var_sp : modules_var_list) {
-    std::string qualified_name = llvm::formatv("::{0}", name_ref).str();
-    if (var_sp->NameMatches(ConstString(name_ref)) ||
-        var_sp->NameMatches(ConstString(qualified_name))) {
+  if (!modules_var_list.Empty()) {
----------------
labath wrote:

I'd just delete this check. The function does the right thing when called with an empty list, and I doubt it's going to be faster.

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


More information about the lldb-commits mailing list