From: Lang Hames Date: Thu, 17 Mar 2016 23:43:33 +0000 (+0000) Subject: [Support] Address some of dblaikie's feedback for r263749. X-Git-Tag: llvmorg-3.9.0-rc1~11492 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=64e936f41c1b733244809ee1b1f1af6ffa2513b3;p=platform%2Fupstream%2Fllvm.git [Support] Address some of dblaikie's feedback for r263749. Fixes some missing std::moves and take Expected by rvalue reference in the call operator. llvm-svn: 263764 --- diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index 2e1699e..3c9bb9a 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -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 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 - T operator()(Expected E) const { + T operator()(Expected &&E) const { checkError(E.takeError()); return std::move(*E); }