mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
[Support] Address some of dblaikie's feedback for r263749.
Fixes some missing std::moves and take Expected<T> by rvalue reference in the call operator. llvm-svn: 263764
This commit is contained in:
parent
8b73d34d94
commit
af65e50861
@ -752,17 +752,17 @@ public:
|
||||
|
||||
/// Create an error on exit helper.
|
||||
ExitOnError(std::string Banner = "", int DefaultErrorExitCode = 1)
|
||||
: Banner(Banner),
|
||||
: Banner(std::move(Banner)),
|
||||
GetExitCode([=](const Error&) { return DefaultErrorExitCode; }) {}
|
||||
|
||||
/// Set the banner string for any errors caught by operator().
|
||||
void setBanner(std::string Banner) {
|
||||
this->Banner = Banner;
|
||||
this->Banner = std::move(Banner);
|
||||
}
|
||||
|
||||
/// Set the exit-code mapper function.
|
||||
void setExitCodeMapper(std::function<int(const Error&)> GetExitCode) {
|
||||
this->GetExitCode = GetExitCode;
|
||||
this->GetExitCode = std::move(GetExitCode);
|
||||
}
|
||||
|
||||
/// Check Err. If it's in a failure state log the error(s) and exit.
|
||||
@ -773,7 +773,7 @@ public:
|
||||
/// Check E. If it's in a success state return the contained value. If it's
|
||||
/// in a failure state log the error(s) and exit.
|
||||
template <typename T>
|
||||
T operator()(Expected<T> E) const {
|
||||
T operator()(Expected<T> &&E) const {
|
||||
checkError(E.takeError());
|
||||
return std::move(*E);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user