<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 26, 2016 at 2:15 PM, Lang Hames via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: lhames<br>
Date: Thu May 26 16:15:58 2016<br>
New Revision: 270916<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=270916&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=270916&view=rev</a><br>
Log:<br>
[Error] Make ECError only constructible via errorCodeToError.<br>
<br>
This enforces idiomatic usage of ECError removing the option to construct them<br>
using make_error.<br>
<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/Support/Error.h<br>
<br>
Modified: llvm/trunk/include/llvm/Support/Error.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=270916&r1=270915&r2=270916&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=270916&r1=270915&r2=270916&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Support/Error.h (original)<br>
+++ llvm/trunk/include/llvm/Support/Error.h Thu May 26 16:15:58 2016<br>
@@ -835,9 +835,8 @@ private:<br>
 /// (or Expected) and you want to call code that still returns<br>
 /// std::error_codes.<br>
 class ECError : public ErrorInfo<ECError> {<br>
+  friend Error errorCodeToError(std::error_code);<br>
 public:<br>
-  ECError() = default;<br>
-  ECError(std::error_code EC) : EC(EC) {}<br>
   void setErrorCode(std::error_code EC) { this->EC = EC; }<br>
   std::error_code convertToErrorCode() const override { return EC; }<br>
   void log(raw_ostream &OS) const override { OS << EC.message(); }<br>
@@ -846,6 +845,8 @@ public:<br>
   static char ID;<br>
<br>
 protected:<br>
+  ECError() = default;<br>
+  ECError(std::error_code EC) : EC(EC) {}<br>
   std::error_code EC;<br>
 };<br>
<br>
@@ -853,7 +854,7 @@ protected:<br>
 inline Error errorCodeToError(std::error_code EC) {<br>
   if (!EC)<br>
     return Error::success();<br>
-  return make_error<ECError>(EC);<br>
+  return Error(llvm::make_unique<ECError>(ECError(EC)));<br></blockquote><div><br></div><div>Do you have an extra "ECError" in there? Looks like it should be:<br><br>  return Error(llvm::make_unique<ECError>(EC));<br><br>?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 }<br>
<br>
 /// Helper for converting an ECError to a std::error_code.<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>