зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625138 - Part 30: Replace mozilla::RemoveCV with std::remove_cv. r=froydnj,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D68547 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
95c76a6863
Коммит
cf0b1e89e9
|
@ -110,7 +110,7 @@ inline bool IsSuccess(PcqStatus status) { return status == PcqStatus::Success; }
|
|||
|
||||
template <typename T>
|
||||
struct RemoveCVR {
|
||||
using Type = std::remove_reference_t<typename RemoveCV<T>::Type>;
|
||||
using Type = std::remove_reference_t<std::remove_cv_t<T>>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -1169,7 +1169,7 @@ class Consumer : public detail::PcqBase {
|
|||
template <typename Arg>
|
||||
PcqStatus TryCopyOrSkipItem(ConsumerView& aView, Arg* aArg) {
|
||||
return PcqParamTraits<typename RemoveCVR<Arg>::Type>::Read(
|
||||
aView, const_cast<typename RemoveCV<Arg>::Type*>(aArg));
|
||||
aView, const_cast<std::remove_cv_t<Arg>*>(aArg));
|
||||
}
|
||||
|
||||
template <typename Arg>
|
||||
|
|
|
@ -179,7 +179,7 @@ class CommandSink : public BasicSink {
|
|||
// non-void return value, non-const method variant
|
||||
template <typename T, typename ReturnType, typename... Args>
|
||||
bool DispatchAsyncMethod(T& aObj, ReturnType (T::*aMethod)(Args...)) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!ReadArgs(args)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ class CommandSink : public BasicSink {
|
|||
template <typename T, typename ReturnType, typename... Args>
|
||||
bool DispatchAsyncMethod(const T& aObj,
|
||||
ReturnType (T::*aMethod)(Args...) const) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!ReadArgs(args)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ class CommandSink : public BasicSink {
|
|||
// void return value, non-const method variant
|
||||
template <typename T, typename... Args>
|
||||
bool DispatchAsyncMethod(T* aObj, void (T::*aMethod)(Args...)) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!ReadArgs(args)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ class CommandSink : public BasicSink {
|
|||
// void return value, const method variant
|
||||
template <typename T, typename... Args>
|
||||
bool DispatchAsyncMethod(const T* aObj, void (T::*aMethod)(Args...) const) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!ReadArgs(args)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ class SyncCommandSink : public CommandSink<Command> {
|
|||
template <typename T, typename ReturnType, typename... Args>
|
||||
bool DispatchSyncMethod(T& aObj,
|
||||
ReturnType SINK_FCN_CC (T::*aMethod)(Args...)) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!BaseType::ReadArgs(args)) {
|
||||
WriteNAK();
|
||||
return false;
|
||||
|
@ -382,7 +382,7 @@ class SyncCommandSink : public CommandSink<Command> {
|
|||
template <typename T, typename ReturnType, typename... Args>
|
||||
bool DispatchSyncMethod(const T& aObj,
|
||||
ReturnType SINK_FCN_CC (T::*aMethod)(Args...) const) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!BaseType::ReadArgs(args)) {
|
||||
WriteNAK();
|
||||
return false;
|
||||
|
@ -399,7 +399,7 @@ class SyncCommandSink : public CommandSink<Command> {
|
|||
template <typename T, typename ReturnType, typename... Args>
|
||||
bool DispatchSyncMethod(T& aObj,
|
||||
ReturnType __stdcall (T::*aMethod)(Args...)) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!BaseType::ReadArgs(args)) {
|
||||
WriteNAK();
|
||||
return false;
|
||||
|
@ -415,7 +415,7 @@ class SyncCommandSink : public CommandSink<Command> {
|
|||
template <typename T, typename ReturnType, typename... Args>
|
||||
bool DispatchSyncMethod(const T& aObj,
|
||||
ReturnType __stdcall (T::*aMethod)(Args...) const) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!BaseType::ReadArgs(args)) {
|
||||
WriteNAK();
|
||||
return false;
|
||||
|
@ -431,7 +431,7 @@ class SyncCommandSink : public CommandSink<Command> {
|
|||
// __cdecl/__thiscall non-const void method variant
|
||||
template <typename T, typename... Args>
|
||||
bool DispatchSyncMethod(T& aObj, void SINK_FCN_CC (T::*aMethod)(Args...)) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!BaseType::ReadArgs(args)) {
|
||||
WriteNAK();
|
||||
return false;
|
||||
|
@ -446,7 +446,7 @@ class SyncCommandSink : public CommandSink<Command> {
|
|||
template <typename T, typename... Args>
|
||||
bool DispatchSyncMethod(const T& aObj,
|
||||
void SINK_FCN_CC (T::*aMethod)(Args...) const) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!BaseType::ReadArgs(args)) {
|
||||
WriteNAK();
|
||||
return false;
|
||||
|
@ -461,7 +461,7 @@ class SyncCommandSink : public CommandSink<Command> {
|
|||
// __stdcall non-const void method variant
|
||||
template <typename T, typename... Args>
|
||||
bool DispatchSyncMethod(T& aObj, void __stdcall (T::*aMethod)(Args...)) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!BaseType::ReadArgs(args)) {
|
||||
WriteNAK();
|
||||
return false;
|
||||
|
@ -476,7 +476,7 @@ class SyncCommandSink : public CommandSink<Command> {
|
|||
template <typename T, typename... Args>
|
||||
bool DispatchSyncMethod(const T& aObj,
|
||||
void __stdcall (T::*aMethod)(Args...) const) {
|
||||
std::tuple<typename RemoveCV<std::remove_reference_t<Args>>::Type...> args;
|
||||
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> args;
|
||||
if (!BaseType::ReadArgs(args)) {
|
||||
WriteNAK();
|
||||
return false;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#ifndef WEBGLPCQPARAMTRAITS_H_
|
||||
#define WEBGLPCQPARAMTRAITS_H_
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "mozilla/dom/ProducerConsumerQueue.h"
|
||||
#include "TexUnpackBlob.h"
|
||||
#include "WebGLContext.h"
|
||||
|
@ -101,8 +103,8 @@ struct PcqParamTraits<RawBuffer<T>> {
|
|||
: aProducerView.Status();
|
||||
}
|
||||
|
||||
template <typename ElementType =
|
||||
typename RemoveCV<typename ParamType::ElementType>::Type>
|
||||
template <
|
||||
typename ElementType = std::remove_cv_t<typename ParamType::ElementType>>
|
||||
static PcqStatus Read(ConsumerView& aConsumerView, ParamType* aArg) {
|
||||
size_t len;
|
||||
PcqStatus status = aConsumerView.ReadParam(&len);
|
||||
|
|
|
@ -708,7 +708,7 @@ struct ICRData {
|
|||
* inner data type must be trivially copyable by memcpy. A RawBuffer
|
||||
* may be backed by local memory or shared memory.
|
||||
*/
|
||||
template <typename T = uint8_t, typename nonCV = typename RemoveCV<T>::Type,
|
||||
template <typename T = uint8_t, typename nonCV = std::remove_cv_t<T>,
|
||||
std::enable_if_t<std::is_trivially_assignable<nonCV&, nonCV>::value,
|
||||
int> = 0>
|
||||
class RawBuffer {
|
||||
|
|
|
@ -171,11 +171,11 @@ struct CompactPair : private detail::CompactPairHelper<A, B> {
|
|||
* will return a CompactPair<Foo, Bar>.
|
||||
*/
|
||||
template <typename A, typename B>
|
||||
CompactPair<typename RemoveCV<std::remove_reference_t<A>>::Type,
|
||||
typename RemoveCV<std::remove_reference_t<B>>::Type>
|
||||
CompactPair<std::remove_cv_t<std::remove_reference_t<A>>,
|
||||
std::remove_cv_t<std::remove_reference_t<B>>>
|
||||
MakeCompactPair(A&& aA, B&& aB) {
|
||||
return CompactPair<typename RemoveCV<std::remove_reference_t<A>>::Type,
|
||||
typename RemoveCV<std::remove_reference_t<B>>::Type>(
|
||||
return CompactPair<std::remove_cv_t<std::remove_reference_t<A>>,
|
||||
std::remove_cv_t<std::remove_reference_t<B>>>(
|
||||
std::forward<A>(aA), std::forward<B>(aB));
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ struct MaybePoisoner {
|
|||
static void poison(void* aPtr) {
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
if (N >= sizeof(uintptr_t)) {
|
||||
PoisonObject(static_cast<typename RemoveCV<T>::Type*>(aPtr));
|
||||
PoisonObject(static_cast<std::remove_cv_t<T>*>(aPtr));
|
||||
}
|
||||
#endif
|
||||
MOZ_MAKE_MEM_UNDEFINED(aPtr, N);
|
||||
|
@ -774,7 +774,7 @@ constexpr Maybe<T&> SomeRef(T& aValue) {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
Maybe<typename RemoveCV<std::remove_reference_t<T>>::Type> ToMaybe(T* aPtr) {
|
||||
Maybe<std::remove_cv_t<std::remove_reference_t<T>>> ToMaybe(T* aPtr) {
|
||||
if (aPtr) {
|
||||
return Some(*aPtr);
|
||||
}
|
||||
|
|
|
@ -72,8 +72,6 @@ inline size_t strlen16(const char16_t* aZeroTerminated) {
|
|||
|
||||
// C++14 types that we don't have because we build as C++11.
|
||||
template <class T>
|
||||
using remove_cv_t = typename mozilla::RemoveCV<T>::Type;
|
||||
template <class T>
|
||||
using remove_const_t = typename mozilla::RemoveConst<T>::Type;
|
||||
|
||||
template <class T>
|
||||
|
@ -84,7 +82,7 @@ struct is_span_oracle<mozilla::Span<ElementType, Extent>> : mozilla::TrueType {
|
|||
};
|
||||
|
||||
template <class T>
|
||||
struct is_span : public is_span_oracle<remove_cv_t<T>> {};
|
||||
struct is_span : public is_span_oracle<std::remove_cv_t<T>> {};
|
||||
|
||||
template <class T>
|
||||
struct is_std_array_oracle : mozilla::FalseType {};
|
||||
|
@ -94,7 +92,7 @@ struct is_std_array_oracle<std::array<ElementType, Extent>>
|
|||
: mozilla::TrueType {};
|
||||
|
||||
template <class T>
|
||||
struct is_std_array : public is_std_array_oracle<remove_cv_t<T>> {};
|
||||
struct is_std_array : public is_std_array_oracle<std::remove_cv_t<T>> {};
|
||||
|
||||
template <size_t From, size_t To>
|
||||
struct is_allowed_extent_conversion
|
||||
|
|
|
@ -206,19 +206,6 @@ struct RemoveVolatile<volatile T> {
|
|||
typedef T Type;
|
||||
};
|
||||
|
||||
/**
|
||||
* RemoveCV removes top-level const and volatile qualifications on a type.
|
||||
*
|
||||
* mozilla::RemoveCV<int>::Type is int;
|
||||
* mozilla::RemoveCV<const int>::Type is int;
|
||||
* mozilla::RemoveCV<volatile int>::Type is int;
|
||||
* mozilla::RemoveCV<int* const volatile>::Type is int*.
|
||||
*/
|
||||
template <typename T>
|
||||
struct RemoveCV {
|
||||
typedef typename RemoveConst<typename RemoveVolatile<T>::Type>::Type Type;
|
||||
};
|
||||
|
||||
} /* namespace mozilla */
|
||||
|
||||
#endif /* mozilla_TypeTraits_h */
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/Vector.h"
|
||||
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
namespace mozilla {
|
||||
namespace interceptor {
|
||||
|
@ -837,10 +838,10 @@ class MOZ_STACK_CLASS ReadOnlyTargetFunction final {
|
|||
template <typename T>
|
||||
auto ChasePointer() {
|
||||
mTargetBytes->EnsureLimit(mOffset + sizeof(T));
|
||||
const typename RemoveCV<T>::Type result =
|
||||
*reinterpret_cast<const typename RemoveCV<T>::Type*>(
|
||||
const std::remove_cv_t<T> result =
|
||||
*reinterpret_cast<const std::remove_cv_t<T>*>(
|
||||
mTargetBytes->GetLocalBytes() + mOffset);
|
||||
return ChasePointerHelper<typename RemoveCV<T>::Type>::Result(
|
||||
return ChasePointerHelper<std::remove_cv_t<T>>::Result(
|
||||
mTargetBytes->GetMMPolicy(), result);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <initializer_list>
|
||||
#include <new>
|
||||
#include <ostream>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "mozilla/Alignment.h"
|
||||
|
@ -626,8 +627,8 @@ class nsTArrayElementTraits {
|
|||
// Invoke the copy-constructor in place.
|
||||
template <class A>
|
||||
static inline void Construct(E* aE, A&& aArg) {
|
||||
typedef typename mozilla::RemoveCV<E>::Type E_NoCV;
|
||||
typedef typename mozilla::RemoveCV<A>::Type A_NoCV;
|
||||
using E_NoCV = std::remove_cv_t<E>;
|
||||
using A_NoCV = std::remove_cv_t<A>;
|
||||
static_assert(!mozilla::IsSame<E_NoCV*, A_NoCV>::value,
|
||||
"For safety, we disallow constructing nsTArray<E> elements "
|
||||
"from E* pointers. See bug 960591.");
|
||||
|
@ -636,9 +637,9 @@ class nsTArrayElementTraits {
|
|||
// Construct in place.
|
||||
template <class... Args>
|
||||
static inline void Emplace(E* aE, Args&&... aArgs) {
|
||||
typedef typename mozilla::RemoveCV<E>::Type E_NoCV;
|
||||
typedef typename mozilla::RemoveCV<
|
||||
typename ::detail::ChooseFirst<Args...>::Type>::Type A_NoCV;
|
||||
using E_NoCV = std::remove_cv_t<E>;
|
||||
using A_NoCV =
|
||||
std::remove_cv_t<typename ::detail::ChooseFirst<Args...>::Type>;
|
||||
static_assert(!mozilla::IsSame<E_NoCV*, A_NoCV>::value,
|
||||
"For safety, we disallow constructing nsTArray<E> elements "
|
||||
"from E* pointers. See bug 960591.");
|
||||
|
|
|
@ -585,7 +585,7 @@ struct IsRefcountedSmartPointerHelper<nsCOMPtr<Pointee>> : TrueType {};
|
|||
|
||||
template <typename T>
|
||||
struct IsRefcountedSmartPointer
|
||||
: detail::IsRefcountedSmartPointerHelper<typename RemoveCV<T>::Type> {};
|
||||
: detail::IsRefcountedSmartPointerHelper<std::remove_cv_t<T>> {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
@ -608,7 +608,7 @@ struct RemoveSmartPointerHelper<T, nsCOMPtr<Pointee>> {
|
|||
|
||||
template <typename T>
|
||||
struct RemoveSmartPointer
|
||||
: detail::RemoveSmartPointerHelper<T, typename RemoveCV<T>::Type> {};
|
||||
: detail::RemoveSmartPointerHelper<T, std::remove_cv_t<T>> {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
@ -636,7 +636,7 @@ struct RemoveRawOrSmartPointerHelper<T, nsCOMPtr<Pointee>> {
|
|||
|
||||
template <typename T>
|
||||
struct RemoveRawOrSmartPointer
|
||||
: detail::RemoveRawOrSmartPointerHelper<T, typename RemoveCV<T>::Type> {};
|
||||
: detail::RemoveRawOrSmartPointerHelper<T, std::remove_cv_t<T>> {};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче