From: Simon Pilgrim Date: Thu, 4 Apr 2019 11:12:30 +0000 (+0000) Subject: Revert rL357655 and rL357656 from llvm/trunk: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4cb71b7a5e4d71ba5fc9c2f77fc247e7f276262d;p=llvm Revert rL357655 and rL357656 from llvm/trunk: Fix minor innaccuracy in previous comment on ManagedStaticBase ........ Make ManagedStatic constexpr constructible Apparently it needs member initializers so that it can be constructed in a constexpr context. I explained my investigation of this in PR41367. ........ Causes vs2017 debug llvm-tblgen to fail with "Unknown command line argument" errors - similar to the vs2019 error discussed on PR41367 without the patch.... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357685 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/ManagedStatic.h b/include/llvm/Support/ManagedStatic.h index 0c02e136744..441f24e05af 100644 --- a/include/llvm/Support/ManagedStatic.h +++ b/include/llvm/Support/ManagedStatic.h @@ -37,18 +37,13 @@ class ManagedStaticBase { protected: // This should only be used as a static variable, which guarantees that this // will be zero initialized. - mutable std::atomic Ptr{nullptr}; - mutable void (*DeleterFn)(void *) = nullptr; - mutable const ManagedStaticBase *Next = nullptr; + mutable std::atomic Ptr; + mutable void (*DeleterFn)(void*); + mutable const ManagedStaticBase *Next; void RegisterManagedStatic(void *(*creator)(), void (*deleter)(void*)) const; public: - /// ManagedStaticBase must be constexpr constructed so that they can be - /// accessed during dynamic initilization of other global variables, such as - /// cl::opt command line flags. - constexpr ManagedStaticBase() = default; - /// isConstructed - Return true if this object has not been created yet. bool isConstructed() const { return Ptr != nullptr; }