Author: Michael Buch Date: 2025-07-03T10:28:49+01:00 New Revision: 4017dc06e3b5c4b97d8b1089070f88363e0db6f0
URL: https://github.com/llvm/llvm-project/commit/4017dc06e3b5c4b97d8b1089070f88363e0db6f0 DIFF: https://github.com/llvm/llvm-project/commit/4017dc06e3b5c4b97d8b1089070f88363e0db6f0.diff LOG: [lldb][Commands][NFC] image lookup: remove unused local variable (#146554) The `current_module` pointer here was never set, but we check it when looping over the `target_modules` list. Presumably the intention was to avoid calling `LookupInModule` if we already found the type in the current module. This patch removes this `current_module`. If we decide the output below is not what the user should see, we can revisit the implementation. Current output: ``` (lldb) im loo -vt Foo --all Best match found in /Users/jonas/Git/llvm-worktrees/llvm-project/a.out: id = {0x00000037}, name = "Foo", byte-size = 1, decl = foo.cpp:1, compiler_type = "struct Foo { }" 1 match found in /Users/jonas/Git/llvm-worktrees/llvm-project/a.out: id = {0x00000037}, name = "Foo", byte-size = 1, decl = foo.cpp:1, compiler_type = "struct Foo { }" ``` which seems fine. Note, there can be multiple matches *within* the current module, so if we did the naive thing of skipping the `current_module` when printing with `--all`, then we would miss some matches. Added: Modified: lldb/source/Commands/CommandObjectTarget.cpp Removed: ################################################################################ diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index a4ced37649ea0..fe421adfe8709 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -4086,8 +4086,6 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed { // Dump all sections for all modules images if (command.GetArgumentCount() == 0) { - ModuleSP current_module; - // Where it is possible to look in the current symbol context first, // try that. If this search was successful and --all was not passed, // don't print anything else. @@ -4110,8 +4108,7 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed { } for (ModuleSP module_sp : target_modules.ModulesNoLocking()) { - if (module_sp != current_module && - LookupInModule(m_interpreter, module_sp.get(), result, + if (LookupInModule(m_interpreter, module_sp.get(), result, syntax_error)) { result.GetOutputStream().EOL(); num_successful_lookups++; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits