[Lldb-commits] [PATCH] D107704: [LLDB][NFC] Simplify IOHandler's getLine to avoid strange casts and redundant checks

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 9 09:11:29 PDT 2021


teemperor requested changes to this revision.
teemperor added a comment.
This revision now requires changes to proceed.

Thanks for the patch! I think we can actually simplify that code even more by just removing the `!got_line` checks in both ifs? There is really no reason to have them from what I can see.



================
Comment at: lldb/source/Core/IOHandler.cpp:402
   if (!got_line && in) {
     m_editing = true;
+    do {
----------------
Just a small FYI: I removed the `m_editing` variable here in 324000054652d47467d23b73ada5c8a599087167 


================
Comment at: lldb/source/Core/IOHandler.cpp:435
       m_data_recorder->Record(line, true);
+    return true;
   }
----------------
This version is fine too, but we could potentially do an LLVMy early return:

```
lang=c++
if (!got_line)
  return false;
[...]
return true;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107704



More information about the lldb-commits mailing list