11#include "llvm/Support/ErrorHandling.h" 
   22  const char *
name() const noexcept
 override {
 
   23    return "LLDBExpressionCategory";
 
 
   25  std::string 
message(
int __ev)
 const override {
 
 
 
   31  return g_expression_category;
 
 
   36                                 std::vector<DiagnosticDetail> details)
 
 
   50  llvm_unreachable(
"switch needs another case for lldb::Severity enum");
 
 
   56    llvm::raw_string_ostream os(str);
 
 
   66  return llvm::inconvertibleErrorCode();
 
 
   72  return std::make_unique<ExpressionError>(
 
 
   79  llvm::raw_string_ostream stream(str);
 
   85    llvm::StringRef message = diagnostic->GetMessage();
 
   86    auto severity_pos = message.find(severity);
 
   87    stream << message.take_front(severity_pos);
 
   89    if (severity_pos != llvm::StringRef::npos)
 
   90      stream << message.drop_front(severity_pos + severity.size());
 
 
  105  if (!str.empty() && str.back() == 
'\n')
 
 
  112                                          llvm::Twine message)
 const {
 
  113  std::vector<DiagnosticDetail> details;
 
  115    details.push_back(diag->GetDetail());
 
  116  return llvm::make_error<ExpressionError>(result, message.str(), details);
 
 
  122                                      uint32_t compiler_id) {
 
 
  133  va_start(args, format);
 
 
  143                                  llvm::StringRef str) {
 
 
  150                               bool precede_with_newline) {
 
  151  if (precede_with_newline) {
 
 
static llvm::StringRef StringForSeverity(lldb::Severity severity)
ExpressionCategory & expression_category()
A std::error_code category for eErrorTypeExpression.
const char * name() const noexcept override
std::string message(int __ev) const override
size_t void PutString(lldb::Severity severity, llvm::StringRef str)
const DiagnosticList & Diagnostics() const
llvm::Error GetAsError(lldb::ExpressionResults result, llvm::Twine message={}) const
Returns an ExpressionError with arg as error code.
std::string GetString(char separator='\n')
DiagnosticList m_diagnostics
void AddDiagnostic(llvm::StringRef message, lldb::Severity severity, DiagnosticOrigin origin, uint32_t compiler_id=LLDB_INVALID_COMPILER_ID)
size_t Printf(lldb::Severity severity, const char *format,...) __attribute__((format(printf
DiagnosticDetail m_detail
void AppendMessage(llvm::StringRef message, bool precede_with_newline=true)
std::vector< DiagnosticDetail > m_details
void log(llvm::raw_ostream &OS) const override
std::unique_ptr< CloneableError > Clone() const override
ExpressionError(lldb::ExpressionResults result, std::string msg, std::vector< DiagnosticDetail > details={})
std::error_code convertToErrorCode() const override
std::string message() const override
void PutString(llvm::StringRef str)
llvm::StringRef GetString() const
size_t size_t PrintfVarArg(const char *format, va_list args)
A class that represents a running process on the host machine.
const char * toString(AppleArm64ExceptionClass EC)
Severity
Used for expressing severity in logs and diagnostics.
ExpressionResults
The results of expression evaluation.
A compiler-independent representation of an lldb_private::Diagnostic.