[Lldb-commits] [PATCH] D33241: Add Status -- llvm::Error glue

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 16 16:32:55 PDT 2017

zturner added a reviewer: lhames.
zturner added inline comments.

Comment at: include/lldb/Utility/Status.h:108
+  explicit Status(llvm::Error error);
+  explicit operator llvm::Error();
I think we should remove the conversion operator.  Instead, why don't we make a class called `LLDBError` and then just have people say:

Status S = getSomeStatus();
return make_error<LLDBError>(S);

Comment at: source/Utility/Status.cpp:81-88
+Status::operator llvm::Error() {
+  if (Success())
+    return llvm::Error::success();
+  if (m_type == ErrorType::eErrorTypePOSIX)
+    return llvm::errorCodeToError(std::error_code(m_code, std::generic_category()));
+  return llvm::make_error<llvm::StringError>(AsCString(),
+                                             llvm::inconvertibleErrorCode());
Delete in favor of an `LLDBError` class as mentioned before.


More information about the lldb-commits mailing list