Converting object's error_category to a ManagedStatic to avoid static constructors...
[oota-llvm.git] / lib / Object / Error.cpp
index 44667c247b15920432f41381e8b6992cf986bf1e..d2daab72d589da5e4e8ff2f19f567985f47ea42e 100644 (file)
@@ -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;
 }