[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 19 08:55:14 PDT 2018


aprantl added a comment.

In this design the success_handlers return an exit status *and* set a string error. We could unify this by having the handler return an llvm::Error (https://llvm.org/doxygen/classllvm_1_1Error.html). When it is successful, it returns Error::success, otherwise it returns `llvm::make_error<llvm::StringError>("message", llvm::inconvertibleErrorCode)`. In ReturnMIStatus we do something like

  auto status = handler(...)
  bool exit_status =  MIstatus::success;
  handleAllErrors(status.takeError(), [&](const StringError &error) {
    his->SetError(error.getMessage();
    exit_status =  error_handler();
  });
  return exit_status;


https://reviews.llvm.org/D48295





More information about the lldb-commits mailing list