================ @@ -94,26 +123,49 @@ Status Status::FromErrorStringWithFormat(const char *format, ...) { return Status(string); } -Status Status::FromError(llvm::Error error) { return Status(std::move(error)); } +Status Status::FromExpressionError(lldb::ExpressionResults result, + std::string msg) { + return Status(llvm::make_error<ExpressionError>( + std::error_code(result, expression_category()), msg)); +} -llvm::Error Status::ToError() const { - if (Success()) +/// Creates a deep copy of all known errors and converts all other +/// errors to a new llvm::StringError. +static llvm::Error CloneError(llvm::Error &error) { + std::vector<std::unique_ptr<llvm::ErrorInfoBase>> info; ---------------- labath wrote:
How about this: ``` Error result = ErrorSuccess(); auto clone = [](const ErrorInfoBase &e) { if (e.isA<CloneableError>()) return Error(static_cast<const CloneableError &>(e)->Clone()); return make_error<StringError>(e.message(), e.convertToErrorCode(), true); }; visitErrors(r, [&](const ErrorInfoBase &e) { result = joinErrors(std::move(result), clone(e)); }); return result; ``` https://github.com/llvm/llvm-project/pull/106774 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits