[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 19 06:45:55 PST 2024


=?utf-8?q?José?= L. Junior <jljuniorpb at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/76112 at github.com>


DavidSpickett wrote:

> Question: Would be good/necessary to refactor LookupSymbolInModule into some smaller functions? At least separating the printing part?

Maybe this is me being used to monster functions in lldb, but this one seems fine. At least the volume of code.

What you could do is "early return" (/early continue) in a couple of places to reduce the indentation.

1. You could early return if there are no matches.
2. You could `continue` if `Symbol *symbol` is `nullptr`.

This turns it into mostly straight line code (and from there if you did want to break it into functions, it would be easier).

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


More information about the lldb-commits mailing list