================
@@ -37,48 +39,75 @@ class raw_ostream;
 using namespace lldb;
 using namespace lldb_private;
 
-Status::Status() {}
+char CloneableError::ID;
+char MachKernelError::ID;
+char Win32Error::ID;
+char ExpressionError::ID;
+
+namespace {
+/// A std::error_code category for eErrorTypeGeneric.
+class GenericCategory : public std::error_category {
+  const char *name() const override { return "LLDBGenericCategory"; }
+  std::string message(int __ev) const override { return "generic LLDB error"; 
};
+};
+GenericCategory &generic_category() {
+  static GenericCategory g_generic_category;
+  return g_generic_category;
+}
+
+/// A std::error_code category for eErrorTypeExpression.
+class ExpressionCategory : public std::error_category {
+  const char *name() const override { return "LLDBExpressionCategory"; }
+  std::string message(int __ev) const override {
+    return 
ExecutionResultAsCString(static_cast<lldb::ExpressionResults>(__ev));
+  };
+};
+ExpressionCategory &expression_category() {
+  static ExpressionCategory g_expression_category;
+  return g_expression_category;
+}
----------------
adrian-prantl wrote:

For the time being, we do. I'm not opposed to get rid of this later, either. 
Right now expressions return an ExpressionResult enum, which is encoded as this 
custom ExpressionCategory error code in this patch.

A failing expression returns an
   ErrorList({
     ECError(ExpressionCategory, ExpressionResult),
     ExpressionError(diagnostic1), 
     ExpressionError(diagnostic2), 
     ...
   })



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

Reply via email to