Skip to content

Commit 4017dc0

Browse files
authored
[lldb][Commands][NFC] image lookup: remove unused local variable (llvm#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.
1 parent 58d84a6 commit 4017dc0

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lldb/source/Commands/CommandObjectTarget.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4086,8 +4086,6 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed {
40864086
// Dump all sections for all modules images
40874087

40884088
if (command.GetArgumentCount() == 0) {
4089-
ModuleSP current_module;
4090-
40914089
// Where it is possible to look in the current symbol context first,
40924090
// try that. If this search was successful and --all was not passed,
40934091
// don't print anything else.
@@ -4110,8 +4108,7 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed {
41104108
}
41114109

41124110
for (ModuleSP module_sp : target_modules.ModulesNoLocking()) {
4113-
if (module_sp != current_module &&
4114-
LookupInModule(m_interpreter, module_sp.get(), result,
4111+
if (LookupInModule(m_interpreter, module_sp.get(), result,
41154112
syntax_error)) {
41164113
result.GetOutputStream().EOL();
41174114
num_successful_lookups++;

0 commit comments

Comments
 (0)