[Lldb-commits] [PATCH] D88229: Reland "[lldb] Don't send invalid region addresses to lldb server"

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 25 03:44:35 PDT 2020


DavidSpickett added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectMemory.cpp:1701
       } else {
         if (command.GetArgumentCount() == 1) {
           auto load_addr_str = command[0].ref();
----------------
stella.stamenova wrote:
> Actually, I would change the logic here a little bit to make it easier to read. Right now it is:
> 
> ```
> if (argc > 1 || ... ) {
> } else {
>   if (GetArgumentCount() == 1) {
>   }
>   ...
> }
> ```
> 
> It should be:
> 
> ```
> if (argc > 1 || ... ) {
> } else if (argc == 1) { //since argc already has the value of GetArgumentCount()
> }
> 
> if (result.Succeeded()) {
>  ...
> }
> ```
> 
> This will make the function more readable, fixing the bug that you found, preserving most of its logic and keeping the single return.
> 
You're the second person to bring this up, so I've converted the logic to return early. (I know that's more than you asked but I think it helps overall)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88229/new/

https://reviews.llvm.org/D88229



More information about the lldb-commits mailing list