#pragma once
namespace folly {
FOLLY_ALWAYS_INLINE void compiler_may_unsafely_assume(bool cond) { … }
[[noreturn]] FOLLY_ALWAYS_INLINE void
compiler_may_unsafely_assume_unreachable() { … }
FOLLY_ALWAYS_INLINE void compiler_may_unsafely_assume_separate_storage(
void const* const a, void const* const b) { … }
#if defined(_MSC_VER) && !defined(__clang__)
namespace detail {
#pragma optimize("", off)
inline void compiler_must_force_sink(void const*) {}
#pragma optimize("", on)
}
template <typename T>
FOLLY_ALWAYS_INLINE void compiler_must_not_elide_fn::operator()(
T const& t) const noexcept {
detail::compiler_must_force_sink(&t);
}
template <typename T>
FOLLY_ALWAYS_INLINE void compiler_must_not_predict_fn::operator()(
T& t) const noexcept {
detail::compiler_must_force_sink(&t);
}
#else
namespace detail {
compiler_must_force_indirect;
template <typename T>
FOLLY_ALWAYS_INLINE void compiler_must_not_elide(T const& t, std::false_type) { … }
template <typename T>
FOLLY_ALWAYS_INLINE void compiler_must_not_elide(T const& t, std::true_type) { … }
template <typename T>
FOLLY_ALWAYS_INLINE void compiler_must_not_predict(T& t, std::false_type) { … }
template <typename T>
FOLLY_ALWAYS_INLINE void compiler_must_not_predict(T& t, std::true_type) { … }
}
template <typename T>
FOLLY_ALWAYS_INLINE void compiler_must_not_elide_fn::operator()(
T const& t) const noexcept { … }
template <typename T>
FOLLY_ALWAYS_INLINE void compiler_must_not_predict_fn::operator()(
T& t) const noexcept { … }
#endif
}