<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Yea, I’ve noticed this is a re-occurring pattern. Once we’ve moved our minimum MSVC version up to one that supports C++14’s std::error_category we’ll need to go and clean these up.<div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On Sep 19, 2014, at 3:44 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Sep 19, 2014 at 3:09 PM, Chris Bieneman <span dir="ltr" class=""><<a href="mailto:beanz@apple.com" target="_blank" class="">beanz@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: cbieneman<br class="">
Date: Fri Sep 19 17:09:18 2014<br class="">
New Revision: 218160<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=218160&view=rev" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=218160&view=rev</a><br class="">
Log:<br class="">
Converting object's error_category to a ManagedStatic to avoid static constructors and destructors.<br class=""></blockquote><div class=""><br class=""></div><div class="">Hmm. Pity. In C++14 std::error_category's ctor is required to be constexpr... well, one day when we adopt C++14 we can remove this workaround.</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="">
Modified:<br class="">
llvm/trunk/lib/Object/Error.cpp<br class="">
<br class="">
Modified: llvm/trunk/lib/Object/Error.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Error.cpp?rev=218160&r1=218159&r2=218160&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Error.cpp?rev=218160&r1=218159&r2=218160&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/Object/Error.cpp (original)<br class="">
+++ llvm/trunk/lib/Object/Error.cpp Fri Sep 19 17:09:18 2014<br class="">
@@ -13,6 +13,7 @@<br class="">
<br class="">
#include "llvm/Object/Error.h"<br class="">
#include "llvm/Support/ErrorHandling.h"<br class="">
+#include "llvm/Support/ManagedStatic.h"<br class="">
<br class="">
using namespace llvm;<br class="">
using namespace object;<br class="">
@@ -48,7 +49,8 @@ std::string _object_error_category::mess<br class="">
"defined.");<br class="">
}<br class="">
<br class="">
+static ManagedStatic<_object_error_category> error_category;<br class="">
+<br class="">
const std::error_category &object::object_category() {<br class="">
- static _object_error_category o;<br class="">
- return o;<br class="">
+ return *error_category;<br class="">
}<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
llvm-commits mailing list<br class="">
<a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></div></div></body></html>