[Lldb-commits] [PATCH] D89283: [trace][intel-pt] Implement the basic decoding functionality

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 2 00:43:54 PST 2020


labath added a subscriber: lhames.
labath added a comment.

A more light-weight approach to this would be to store the `ErrorInfo` object from the `Error` and copy that when needed. Something like:

  class IntelPTInstruction {
    std::unique_ptr<ErrorInfoBase> m_error; // Technically, this should be a vector, but we don't really make use of the error list functionality anywhere.
    
    IntelPTInstruction(Error err) {
      handleAllErrors(std::move(err), [&](std::unique_ptr<ErrorInfoBase> info) { m_error = std::move(info); }); // Stash it for later use
    }
  
    Error ToError() {
      if (m_error->isA<IntelPTError>())
        return make_error<IntelPTError>(static_cast<IntelPTError&>(*m_error)); // IntelPTError is copyable
      return make_error<StringError>(m_error->message(), m_error->convertToErrorCode()); // Just copy the error message
    }
  };

But maybe there are other solutions too. Adding @lhames, in case he knows about any...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89283/new/

https://reviews.llvm.org/D89283



More information about the lldb-commits mailing list