[llvm] r218168 - Converting InstrProf's error_category to a ManagedStatic to avoid static constructors and destructors.

Chris Bieneman beanz at apple.com
Fri Sep 19 16:19:24 PDT 2014


Author: cbieneman
Date: Fri Sep 19 18:19:24 2014
New Revision: 218168

URL: http://llvm.org/viewvc/llvm-project?rev=218168&view=rev
Log:
Converting InstrProf's error_category to a ManagedStatic to avoid static constructors and destructors.

Modified:
    llvm/trunk/lib/ProfileData/InstrProf.cpp

Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=218168&r1=218167&r2=218168&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp Fri Sep 19 18:19:24 2014
@@ -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 : publi
 };
 }
 
+static ManagedStatic<InstrProfErrorCategoryType> ErrorCategory;
+
 const std::error_category &llvm::instrprof_category() {
-  static InstrProfErrorCategoryType C;
-  return C;
+  return *ErrorCategory;
 }





More information about the llvm-commits mailing list