[Lldb-commits] [PATCH] D111890: [lldb] [Host] Make Terminal methods return llvm::Error

Nico Weber via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 28 09:36:05 PDT 2021


thakis added a comment.

In D111890#3090653 <https://reviews.llvm.org/D111890#3090653>, @mgorny wrote:

> In D111890#3090632 <https://reviews.llvm.org/D111890#3090632>, @thakis wrote:
>
>> This causes lots of warnings on Windows, where TERMIOS is false: http://45.33.8.238/win/47744/step_4.txt (look for "Terminal.cpp"). Could you take a look? It looks like return statements are genuinely missing there.
>
> When `LLDB_ENABLE_TERMIOS` is false, `GetData()` always returns an error, so the code below should not be reachable. I suppose I could add `llvm_unreachable()` for that. I'll try that and make a diff if it works.

Maybe it'd be easier to read if you move

  return llvm::createStringError(llvm::inconvertibleErrorCode(),
                                 "termios support missing in LLDB");

into some function and then do

  llvm::Error Terminal::SetCanonical(bool enabled) {
  #if LLDB_ENABLE_TERMIOS
    ...actual body...
  #else
    return ThatErrorFunction();
  #endif
  ``
  
  (etc) in all the functions instead of hiding it in GetData()? Then it's obvious in every function what's going on.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111890



More information about the lldb-commits mailing list