Commit 5f59d5fd authored by Perry Randall's avatar Perry Randall Committed by Facebook Github Bot

Revert D13113756: [Folly] Tweak createGlobal

Differential Revision:
D13113756

Original commit changeset: a40f43280e5f

fbshipit-source-id: 2025c86639ddefa0c254ea7a6f2c5305e71754ee
parent 2f2e1982
...@@ -71,14 +71,18 @@ FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN T* createGlobal(F&& creator) { ...@@ -71,14 +71,18 @@ FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN T* createGlobal(F&& creator) {
return StaticSingletonManager::create<T, Tag>(static_cast<F&&>(creator)); return StaticSingletonManager::create<T, Tag>(static_cast<F&&>(creator));
} }
// TODO(T36779215): A bug in the gcc-5-glibc-2.23 llvm-fb/clang doesn't like
// passing this as a lambda (e.g. P60328775).
namespace {
template <typename T>
T* singleton_global_cons() {
return new T();
}
} // namespace
template <typename T, typename Tag> template <typename T, typename Tag>
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN T* createGlobal() { FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN T* createGlobal() {
struct construct { return createGlobal<T, Tag>(&singleton_global_cons<T>);
T* operator()() const {
return new T();
}
};
return createGlobal<T, Tag>(construct{});
} }
} // namespace detail } // namespace detail
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment