From 784954db31cca0c5b34bd251d853f95b04e2c458 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Fri, 19 Sep 2014 23:19:24 +0000 Subject: [PATCH] Converting InstrProf's error_category to a ManagedStatic to avoid static constructors and destructors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218168 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ProfileData/InstrProf.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ProfileData/InstrProf.cpp b/lib/ProfileData/InstrProf.cpp index 01212227206..900dff96739 100644 --- a/lib/ProfileData/InstrProf.cpp +++ b/lib/ProfileData/InstrProf.cpp @@ -14,6 +14,7 @@ #include "llvm/ProfileData/InstrProf.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/ManagedStatic.h" using namespace llvm; @@ -55,7 +56,8 @@ class InstrProfErrorCategoryType : public std::error_category { }; } +static ManagedStatic ErrorCategory; + const std::error_category &llvm::instrprof_category() { - static InstrProfErrorCategoryType C; - return C; + return *ErrorCategory; } -- 2.34.1