From: Reid Kleckner Date: Thu, 4 Apr 2019 18:45:05 +0000 (+0000) Subject: Appease STLs where std::atomic lacks a constexpr default ctor X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea5a38f994d6a9dcd9aad803e0cd53b60d965025;p=llvm Appease STLs where std::atomic lacks a constexpr default ctor MSVC 2019 casts the pointer to a pointer-sized integer, which is a reinterpret_cast, which is invalid in a constexpr context, so I have to remove the LLVM_REQUIRES_CONSTANT_INITIALIZATION annotation for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357716 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/ManagedStatic.h b/include/llvm/Support/ManagedStatic.h index 0290510e030..30c3daa5ba5 100644 --- a/include/llvm/Support/ManagedStatic.h +++ b/include/llvm/Support/ManagedStatic.h @@ -45,7 +45,7 @@ template struct object_deleter { class ManagedStaticBase { protected: #ifndef LLVM_AVOID_CONSTEXPR_CTOR - mutable std::atomic Ptr; + mutable std::atomic Ptr{nullptr}; mutable void (*DeleterFn)(void *) = nullptr; mutable const ManagedStaticBase *Next = nullptr; #else diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index d2cfef9f42a..1858fe941ae 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -377,12 +377,10 @@ void OptionCategory::registerCategory() { // that this ManagedStatic uses constant initailization and not dynamic // initialization because it is referenced from cl::opt constructors, which run // dynamically in an arbitrary order. -LLVM_REQUIRE_CONSTANT_INITIALIZATION ManagedStatic - llvm::cl::TopLevelSubCommand; +ManagedStatic llvm::cl::TopLevelSubCommand; // A special subcommand that can be used to put an option into all subcommands. -LLVM_REQUIRE_CONSTANT_INITIALIZATION ManagedStatic - llvm::cl::AllSubCommands; +ManagedStatic llvm::cl::AllSubCommands; void SubCommand::registerSubCommand() { GlobalParser->registerSubCommand(this);