]> granicus.if.org Git - llvm/commitdiff
Revert rL357655 and rL357656 from llvm/trunk:
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 4 Apr 2019 11:12:30 +0000 (11:12 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 4 Apr 2019 11:12:30 +0000 (11:12 +0000)
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

include/llvm/Support/ManagedStatic.h

index 0c02e136744e559071fdbc743083e4f904170ffe..441f24e05afc589e597aa288737e060edcdd0699 100644 (file)
@@ -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<void *> Ptr{nullptr};
-  mutable void (*DeleterFn)(void *) = nullptr;
-  mutable const ManagedStaticBase *Next = nullptr;
+  mutable std::atomic<void *> 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; }