From 770163e4f3abee11856d0311966e632b97e85c3f Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Fri, 19 Sep 2014 20:29:02 +0000 Subject: 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 llvm-svn: 218149 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Bitcode/Reader') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 84ee0b4b3a6..80afb56e746 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -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 std::error_category { }; } +static ManagedStatic ErrorCategory; + const std::error_category &llvm::BitcodeErrorCategory() { - static BitcodeErrorCategoryType O; - return O; + return *ErrorCategory; } //===----------------------------------------------------------------------===// -- cgit v1.2.3