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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits