зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625138 - Part 23: Replace mozilla::RemovePointer with std::remove_pointer. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68378 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
44a255a4d6
Коммит
d53798e749
|
@ -41,8 +41,7 @@ class PromiseNativeThenHandlerBase : public PromiseNativeHandler {
|
|||
|
||||
namespace {
|
||||
|
||||
template <typename T,
|
||||
bool = IsRefcounted<typename RemovePointer<T>::Type>::value,
|
||||
template <typename T, bool = IsRefcounted<std::remove_pointer_t<T>>::value,
|
||||
bool = (IsConvertible<T, nsISupports*>::value ||
|
||||
IsConvertible<T*, nsISupports*>::value)>
|
||||
struct StorageTypeHelper {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifdef OS_POSIX
|
||||
# include <errno.h>
|
||||
#endif
|
||||
#include <type_traits>
|
||||
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
|
@ -44,10 +45,10 @@ namespace mozilla {
|
|||
#if defined(XP_WIN)
|
||||
// Generate RAII classes for LPTSTR and PSECURITY_DESCRIPTOR.
|
||||
MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedLPTStr,
|
||||
RemovePointer<LPTSTR>::Type,
|
||||
std::remove_pointer_t<LPTSTR>,
|
||||
::LocalFree)
|
||||
MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(
|
||||
ScopedPSecurityDescriptor, RemovePointer<PSECURITY_DESCRIPTOR>::Type,
|
||||
ScopedPSecurityDescriptor, std::remove_pointer_t<PSECURITY_DESCRIPTOR>,
|
||||
::LocalFree)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <vector>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <type_traits>
|
||||
|
||||
#include "CSFLog.h"
|
||||
#include "WebRtcLog.h"
|
||||
|
@ -98,8 +99,7 @@ class RequestManager {
|
|||
MOZ_CAN_RUN_SCRIPT
|
||||
void Complete() {
|
||||
IgnoredErrorResult rv;
|
||||
using RealCallbackType =
|
||||
typename RemovePointer<decltype(mCallback.get())>::Type;
|
||||
using RealCallbackType = std::remove_pointer_t<decltype(mCallback.get())>;
|
||||
RefPtr<RealCallbackType> callback(mCallback.get());
|
||||
callback->Call(mResult, rv);
|
||||
|
||||
|
|
|
@ -350,41 +350,6 @@ struct AddRvalueReferenceHelper<T, TIsNotVoid> {
|
|||
template <typename T>
|
||||
struct AddRvalueReference : detail::AddRvalueReferenceHelper<T> {};
|
||||
|
||||
/* 20.9.7.5 Pointer modifications [meta.trans.ptr] */
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T, typename CVRemoved>
|
||||
struct RemovePointerHelper {
|
||||
typedef T Type;
|
||||
};
|
||||
|
||||
template <typename T, typename Pointee>
|
||||
struct RemovePointerHelper<T, Pointee*> {
|
||||
typedef Pointee Type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* Produces the pointed-to type if a pointer is provided, else returns the input
|
||||
* type. Note that this does not dereference pointer-to-member pointers.
|
||||
*
|
||||
* struct S { bool m; void f(); };
|
||||
* mozilla::RemovePointer<int>::Type is int;
|
||||
* mozilla::RemovePointer<int*>::Type is int;
|
||||
* mozilla::RemovePointer<int* const>::Type is int;
|
||||
* mozilla::RemovePointer<int* volatile>::Type is int;
|
||||
* mozilla::RemovePointer<const long*>::Type is const long;
|
||||
* mozilla::RemovePointer<void* const>::Type is void;
|
||||
* mozilla::RemovePointer<void (S::*)()>::Type is void (S::*)();
|
||||
* mozilla::RemovePointer<void (*)()>::Type is void();
|
||||
* mozilla::RemovePointer<bool S::*>::Type is bool S::*.
|
||||
*/
|
||||
template <typename T>
|
||||
struct RemovePointer
|
||||
: detail::RemovePointerHelper<T, typename RemoveCV<T>::Type> {};
|
||||
|
||||
/* 20.9.7.6 Other transformations [meta.trans.other] */
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,6 @@ using mozilla::DeclVal;
|
|||
using mozilla::IsConvertible;
|
||||
using mozilla::IsDestructible;
|
||||
using mozilla::IsSame;
|
||||
using mozilla::RemovePointer;
|
||||
|
||||
class PublicDestructible {
|
||||
public:
|
||||
|
@ -107,31 +106,6 @@ static_assert(
|
|||
"decltype should work using a DeclVal'd struct without a default "
|
||||
"constructor");
|
||||
|
||||
struct TestRemovePointer {
|
||||
bool m;
|
||||
void f();
|
||||
};
|
||||
static_assert(IsSame<RemovePointer<int>::Type, int>::value,
|
||||
"removing pointer from int must return int");
|
||||
static_assert(IsSame<RemovePointer<int*>::Type, int>::value,
|
||||
"removing pointer from int* must return int");
|
||||
static_assert(IsSame<RemovePointer<int* const>::Type, int>::value,
|
||||
"removing pointer from int* const must return int");
|
||||
static_assert(IsSame<RemovePointer<int* volatile>::Type, int>::value,
|
||||
"removing pointer from int* volatile must return int");
|
||||
static_assert(IsSame<RemovePointer<const long*>::Type, const long>::value,
|
||||
"removing pointer from const long* must return const long");
|
||||
static_assert(IsSame<RemovePointer<void* const>::Type, void>::value,
|
||||
"removing pointer from void* const must return void");
|
||||
static_assert(IsSame<RemovePointer<void (TestRemovePointer::*)()>::Type,
|
||||
void (TestRemovePointer::*)()>::value,
|
||||
"removing pointer from void (S::*)() must return void (S::*)()");
|
||||
static_assert(IsSame<RemovePointer<void (*)()>::Type, void()>::value,
|
||||
"removing pointer from void (*)() must return void()");
|
||||
static_assert(IsSame<RemovePointer<bool TestRemovePointer::*>::Type,
|
||||
bool TestRemovePointer::*>::value,
|
||||
"removing pointer from bool S::* must return bool S::*");
|
||||
|
||||
/*
|
||||
* Android's broken [u]intptr_t inttype macros are broken because its PRI*PTR
|
||||
* macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "ModuleEvaluator.h"
|
||||
|
||||
#include <algorithm> // For std::find()
|
||||
#include <type_traits>
|
||||
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
|
@ -81,7 +82,7 @@ bool ModuleEvaluator::ResolveKnownFolder(REFKNOWNFOLDERID aFolderId,
|
|||
}
|
||||
|
||||
using ShellStringUniquePtr =
|
||||
UniquePtr<RemovePointer<PWSTR>::Type, CoTaskMemFreeDeleter>;
|
||||
UniquePtr<std::remove_pointer_t<PWSTR>, CoTaskMemFreeDeleter>;
|
||||
|
||||
ShellStringUniquePtr path(rawPath);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
// NB: include this after shldisp.h so its macros do not conflict with COM
|
||||
// interfaces defined by shldisp.h
|
||||
#include <shellapi.h>
|
||||
#include <type_traits>
|
||||
|
||||
#include <comdef.h>
|
||||
#include <comutil.h>
|
||||
|
@ -159,7 +160,7 @@ inline LauncherVoidResult ShellExecuteByExplorer(const _bstr_t& aPath,
|
|||
}
|
||||
|
||||
using UniqueAbsolutePidl =
|
||||
UniquePtr<RemovePointer<PIDLIST_ABSOLUTE>::Type, CoTaskMemFreeDeleter>;
|
||||
UniquePtr<std::remove_pointer_t<PIDLIST_ABSOLUTE>, CoTaskMemFreeDeleter>;
|
||||
|
||||
inline LauncherResult<UniqueAbsolutePidl> ShellParseDisplayName(
|
||||
const wchar_t* aPath) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* -- scc
|
||||
*/
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
|
@ -203,8 +204,7 @@ namespace mozilla {
|
|||
// variety of smart pointer types in addition to raw pointers. These types
|
||||
// include RefPtr<>, nsCOMPtr<>, and OwningNonNull<>.
|
||||
template <class T>
|
||||
using PointedToType =
|
||||
typename mozilla::RemovePointer<decltype(&*mozilla::DeclVal<T>())>::Type;
|
||||
using PointedToType = std::remove_pointer_t<decltype(&*mozilla::DeclVal<T>())>;
|
||||
} // namespace mozilla
|
||||
|
||||
#ifdef NSCAP_FEATURE_USE_BASE
|
||||
|
|
|
@ -386,8 +386,8 @@ class TTokenizer : public TokenizerBase<TChar> {
|
|||
* Same as above, but accepts an integer with an optional minus sign.
|
||||
*/
|
||||
template <typename T, typename V = typename EnableIf<
|
||||
std::is_signed_v<typename RemovePointer<T>::Type>,
|
||||
typename RemovePointer<T>::Type>::Type>
|
||||
std::is_signed_v<std::remove_pointer_t<T>>,
|
||||
std::remove_pointer_t<T>>::Type>
|
||||
[[nodiscard]] bool ReadSignedInteger(T* aValue) {
|
||||
MOZ_RELEASE_ASSERT(aValue);
|
||||
|
||||
|
|
|
@ -1092,10 +1092,10 @@ struct NonPointerStorageClass
|
|||
|
||||
template <typename T>
|
||||
struct NonParameterStorageClass
|
||||
: mozilla::Conditional<std::is_pointer_v<T>,
|
||||
typename PointerStorageClass<
|
||||
typename mozilla::RemovePointer<T>::Type>::Type,
|
||||
typename NonPointerStorageClass<T>::Type> {};
|
||||
: mozilla::Conditional<
|
||||
std::is_pointer_v<T>,
|
||||
typename PointerStorageClass<std::remove_pointer_t<T>>::Type,
|
||||
typename NonPointerStorageClass<T>::Type> {};
|
||||
|
||||
// Choose storage&passing strategy based on preferred storage type:
|
||||
// - If IsParameterStorageClass<T>::value is true, use as-is.
|
||||
|
|
Загрузка…
Ссылка в новой задаче