[llvm] r218149 - Eliminating static destructor for the	BitCodeErrorCategory by converting to a ManagedStatic.
    Chris Bieneman 
    beanz at apple.com
       
    Fri Sep 19 13:29:02 PDT 2014
    
    
  
Author: cbieneman
Date: Fri Sep 19 15:29:02 2014
New Revision: 218149
URL: http://llvm.org/viewvc/llvm-project?rev=218149&view=rev
Log:
Eliminating static destructor for the BitCodeErrorCategory by converting to a ManagedStatic.
Summary: This is part of the overall goal of removing static initializers from LLVM.
Reviewers: chandlerc
Reviewed By: chandlerc
Subscribers: chandlerc, llvm-commits
Differential Revision: http://reviews.llvm.org/D5416
Modified:
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=218149&r1=218148&r2=218149&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Sep 19 15:29:02 2014
@@ -25,6 +25,8 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ManagedStatic.h"
+
 using namespace llvm;
 
 enum {
@@ -3502,9 +3504,10 @@ class BitcodeErrorCategoryType : public
 };
 }
 
+static ManagedStatic<BitcodeErrorCategoryType> ErrorCategory;
+
 const std::error_category &llvm::BitcodeErrorCategory() {
-  static BitcodeErrorCategoryType O;
-  return O;
+  return *ErrorCategory;
 }
 
 //===----------------------------------------------------------------------===//
    
    
More information about the llvm-commits
mailing list