[PATCH] Eliminating static destructor for the BitCodeErrorCategory by converting to a ManagedStatic.

Chandler Carruth chandlerc at gmail.com
Fri Sep 19 13:48:22 PDT 2014


Also, please feel free to just commit any patches that are roughly
equivalent to this. Those seem like strict goodness in all cases. =]

On Fri, Sep 19, 2014 at 1:34 PM, Chandler Carruth <chandlerc at gmail.com>
wrote:

> Yep.
>
> On Fri, Sep 19, 2014 at 1:23 PM, Chandler Carruth <chandlerc at gmail.com>
> wrote:
>
>> 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
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140919/2cbac3fb/attachment.html>


More information about the llvm-commits mailing list