[PATCH] Eliminating static destructor for the BitCodeErrorCategory by converting to a ManagedStatic.
Chandler Carruth
chandlerc at gmail.com
Fri Sep 19 13:23:40 PDT 2014
Looks good with a small tweak below...
================
Comment at: lib/Bitcode/Reader/BitcodeReader.cpp:3508
@@ -3505,3 +3507,3 @@
const std::error_category &llvm::BitcodeErrorCategory() {
- static BitcodeErrorCategoryType O;
- return O;
+ static ManagedStatic<BitcodeErrorCategoryType> O;
+ return *O;
----------------
Since we can't rely on MSVC's thread safe function local statics we have to use a ManagedStatic here... but once we do, on non MSVC we pay the once-init cost twice.
I would just make these globals (sadly) until we only rely on MSVC versions with support for killing managed static entirely.
http://reviews.llvm.org/D5416
More information about the llvm-commits
mailing list