From: Chris Bieneman Date: Fri, 19 Sep 2014 22:09:18 +0000 (+0000) Subject: Converting object's error_category to a ManagedStatic to avoid static constructors... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=1595b128e9deb43a3bb8c93fdcf56c33041e6c53 Converting object's error_category to a ManagedStatic to avoid static constructors and destructors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218160 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/Error.cpp b/lib/Object/Error.cpp index 44667c247b1..d2daab72d58 100644 --- a/lib/Object/Error.cpp +++ b/lib/Object/Error.cpp @@ -13,6 +13,7 @@ #include "llvm/Object/Error.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/ManagedStatic.h" using namespace llvm; using namespace object; @@ -48,7 +49,8 @@ std::string _object_error_category::message(int EV) const { "defined."); } +static ManagedStatic<_object_error_category> error_category; + const std::error_category &object::object_category() { - static _object_error_category o; - return o; + return *error_category; }