forked from mirrors/gecko-dev
Bug 1625138 - Part 40: Replace remaining mozilla::IsSame with std::is_same. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68560 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
62ab594247
commit
13bfe75b97
6 changed files with 28 additions and 46 deletions
|
|
@ -25,23 +25,22 @@
|
||||||
#define NS_QUERYFRAME_HEAD(class) \
|
#define NS_QUERYFRAME_HEAD(class) \
|
||||||
void* class ::QueryFrame(FrameIID id) const { \
|
void* class ::QueryFrame(FrameIID id) const { \
|
||||||
switch (id) {
|
switch (id) {
|
||||||
#define NS_QUERYFRAME_ENTRY(class) \
|
#define NS_QUERYFRAME_ENTRY(class) \
|
||||||
case class ::kFrameIID: { \
|
case class ::kFrameIID: { \
|
||||||
static_assert( \
|
static_assert( \
|
||||||
mozilla::IsSame<class, class ::Has_NS_DECL_QUERYFRAME_TARGET>::value, \
|
std::is_same_v<class, class ::Has_NS_DECL_QUERYFRAME_TARGET>, \
|
||||||
#class " must declare itself as a queryframe target"); \
|
#class " must declare itself as a queryframe target"); \
|
||||||
return const_cast<class*>(static_cast<const class*>(this)); \
|
return const_cast<class*>(static_cast<const class*>(this)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NS_QUERYFRAME_ENTRY_CONDITIONAL(class, condition) \
|
#define NS_QUERYFRAME_ENTRY_CONDITIONAL(class, condition) \
|
||||||
case class ::kFrameIID: \
|
case class ::kFrameIID: \
|
||||||
if (condition) { \
|
if (condition) { \
|
||||||
static_assert( \
|
static_assert( \
|
||||||
mozilla::IsSame<class, \
|
std::is_same_v<class, class ::Has_NS_DECL_QUERYFRAME_TARGET>, \
|
||||||
class ::Has_NS_DECL_QUERYFRAME_TARGET>::value, \
|
#class " must declare itself as a queryframe target"); \
|
||||||
#class " must declare itself as a queryframe target"); \
|
return const_cast<class*>(static_cast<const class*>(this)); \
|
||||||
return const_cast<class*>(static_cast<const class*>(this)); \
|
} \
|
||||||
} \
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#define NS_QUERYFRAME_TAIL_INHERITING(class) \
|
#define NS_QUERYFRAME_TAIL_INHERITING(class) \
|
||||||
|
|
@ -99,10 +98,9 @@ class do_QueryFrameHelper {
|
||||||
|
|
||||||
template <class Dest>
|
template <class Dest>
|
||||||
operator Dest*() {
|
operator Dest*() {
|
||||||
static_assert(
|
static_assert(std::is_same_v<std::remove_const_t<Dest>,
|
||||||
mozilla::IsSame<std::remove_const_t<Dest>,
|
typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>,
|
||||||
typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>::value,
|
"Dest must declare itself as a queryframe target");
|
||||||
"Dest must declare itself as a queryframe target");
|
|
||||||
if (!mRawPtr) {
|
if (!mRawPtr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,26 +102,6 @@ struct IsDestructibleImpl : public DoIsDestructibleImpl {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct IsDestructible : public detail::IsDestructibleImpl<T>::Type {};
|
struct IsDestructible : public detail::IsDestructibleImpl<T>::Type {};
|
||||||
|
|
||||||
/* 20.9.5 Type property queries [meta.unary.prop.query] */
|
|
||||||
|
|
||||||
/* 20.9.6 Relationships between types [meta.rel] */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IsSame tests whether two types are the same type.
|
|
||||||
*
|
|
||||||
* mozilla::IsSame<int, int>::value is true;
|
|
||||||
* mozilla::IsSame<int*, int*>::value is true;
|
|
||||||
* mozilla::IsSame<int, unsigned int>::value is false;
|
|
||||||
* mozilla::IsSame<void, void>::value is true;
|
|
||||||
* mozilla::IsSame<const int, int>::value is false;
|
|
||||||
* mozilla::IsSame<struct S, struct S>::value is true.
|
|
||||||
*/
|
|
||||||
template <typename T, typename U>
|
|
||||||
struct IsSame : std::false_type {};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct IsSame<T, T> : std::true_type {};
|
|
||||||
|
|
||||||
} /* namespace mozilla */
|
} /* namespace mozilla */
|
||||||
|
|
||||||
#endif /* mozilla_TypeTraits_h */
|
#endif /* mozilla_TypeTraits_h */
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
#include "mozilla/TypeTraits.h"
|
#include "mozilla/TypeTraits.h"
|
||||||
|
|
||||||
using mozilla::IsDestructible;
|
using mozilla::IsDestructible;
|
||||||
using mozilla::IsSame;
|
|
||||||
|
|
||||||
class PublicDestructible {
|
class PublicDestructible {
|
||||||
public:
|
public:
|
||||||
|
|
@ -35,9 +36,9 @@ static_assert(IsDestructible<TrivialDestructible>::value,
|
||||||
* actual type sizes seen at compile time.
|
* actual type sizes seen at compile time.
|
||||||
*/
|
*/
|
||||||
#if defined(ANDROID) && !defined(__LP64__)
|
#if defined(ANDROID) && !defined(__LP64__)
|
||||||
static_assert(mozilla::IsSame<int, intptr_t>::value,
|
static_assert(std::is_same_v<int, intptr_t>,
|
||||||
"emulated PRI[di]PTR definitions will be wrong");
|
"emulated PRI[di]PTR definitions will be wrong");
|
||||||
static_assert(mozilla::IsSame<unsigned int, uintptr_t>::value,
|
static_assert(std::is_same_v<unsigned int, uintptr_t>,
|
||||||
"emulated PRI[ouxX]PTR definitions will be wrong");
|
"emulated PRI[ouxX]PTR definitions will be wrong");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
# include "mozilla/StackWalk.h"
|
# include "mozilla/StackWalk.h"
|
||||||
|
|
||||||
# include <ostream>
|
# include <ostream>
|
||||||
|
# include <type_traits>
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace baseprofiler {
|
namespace baseprofiler {
|
||||||
|
|
@ -152,7 +153,7 @@ class MOZ_RAII AutoArraySchemaWriter {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void IntElement(uint32_t aIndex, T aValue) {
|
void IntElement(uint32_t aIndex, T aValue) {
|
||||||
static_assert(!IsSame<T, uint64_t>::value,
|
static_assert(!std::is_same_v<T, uint64_t>,
|
||||||
"Narrowing uint64 -> int64 conversion not allowed");
|
"Narrowing uint64 -> int64 conversion not allowed");
|
||||||
FillUpTo(aIndex);
|
FillUpTo(aIndex);
|
||||||
mJSONWriter.IntElement(static_cast<int64_t>(aValue));
|
mJSONWriter.IntElement(static_cast<int64_t>(aValue));
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include "ProfilerCodeAddressService.h"
|
#include "ProfilerCodeAddressService.h"
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
|
|
@ -161,7 +162,7 @@ class MOZ_RAII AutoArraySchemaWriter {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void IntElement(uint32_t aIndex, T aValue) {
|
void IntElement(uint32_t aIndex, T aValue) {
|
||||||
static_assert(!IsSame<T, uint64_t>::value,
|
static_assert(!std::is_same_v<T, uint64_t>,
|
||||||
"Narrowing uint64 -> int64 conversion not allowed");
|
"Narrowing uint64 -> int64 conversion not allowed");
|
||||||
FillUpTo(aIndex);
|
FillUpTo(aIndex);
|
||||||
mJSONWriter.IntElement(static_cast<int64_t>(aValue));
|
mJSONWriter.IntElement(static_cast<int64_t>(aValue));
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#ifdef MOZ_TASK_TRACER
|
#ifdef MOZ_TASK_TRACER
|
||||||
# include "GeckoTaskTracer.h"
|
# include "GeckoTaskTracer.h"
|
||||||
|
|
@ -2790,8 +2791,8 @@ class SamplerThread {
|
||||||
// It may be tempting for a future maintainer to change aCallbacks into an
|
// It may be tempting for a future maintainer to change aCallbacks into an
|
||||||
// rvalue reference; this will remind them not to do that!
|
// rvalue reference; this will remind them not to do that!
|
||||||
static_assert(
|
static_assert(
|
||||||
IsSame<decltype(aCallbacks),
|
std::is_same_v<decltype(aCallbacks),
|
||||||
UniquePtr<PostSamplingCallbackListItem>>::value,
|
UniquePtr<PostSamplingCallbackListItem>>,
|
||||||
"We need to capture the list by-value, to implicitly destroy it");
|
"We need to capture the list by-value, to implicitly destroy it");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue