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:
André Bargull 2020-03-28 13:57:21 +00:00
parent 62ab594247
commit 13bfe75b97
6 changed files with 28 additions and 46 deletions

View file

@ -25,23 +25,22 @@
#define NS_QUERYFRAME_HEAD(class) \
void* class ::QueryFrame(FrameIID id) const { \
switch (id) {
#define NS_QUERYFRAME_ENTRY(class) \
case class ::kFrameIID: { \
static_assert( \
mozilla::IsSame<class, class ::Has_NS_DECL_QUERYFRAME_TARGET>::value, \
#class " must declare itself as a queryframe target"); \
return const_cast<class*>(static_cast<const class*>(this)); \
#define NS_QUERYFRAME_ENTRY(class) \
case class ::kFrameIID: { \
static_assert( \
std::is_same_v<class, class ::Has_NS_DECL_QUERYFRAME_TARGET>, \
#class " must declare itself as a queryframe target"); \
return const_cast<class*>(static_cast<const class*>(this)); \
}
#define NS_QUERYFRAME_ENTRY_CONDITIONAL(class, condition) \
case class ::kFrameIID: \
if (condition) { \
static_assert( \
mozilla::IsSame<class, \
class ::Has_NS_DECL_QUERYFRAME_TARGET>::value, \
#class " must declare itself as a queryframe target"); \
return const_cast<class*>(static_cast<const class*>(this)); \
} \
#define NS_QUERYFRAME_ENTRY_CONDITIONAL(class, condition) \
case class ::kFrameIID: \
if (condition) { \
static_assert( \
std::is_same_v<class, class ::Has_NS_DECL_QUERYFRAME_TARGET>, \
#class " must declare itself as a queryframe target"); \
return const_cast<class*>(static_cast<const class*>(this)); \
} \
break;
#define NS_QUERYFRAME_TAIL_INHERITING(class) \
@ -99,10 +98,9 @@ class do_QueryFrameHelper {
template <class Dest>
operator Dest*() {
static_assert(
mozilla::IsSame<std::remove_const_t<Dest>,
typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>::value,
"Dest must declare itself as a queryframe target");
static_assert(std::is_same_v<std::remove_const_t<Dest>,
typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>,
"Dest must declare itself as a queryframe target");
if (!mRawPtr) {
return nullptr;
}

View file

@ -102,26 +102,6 @@ struct IsDestructibleImpl : public DoIsDestructibleImpl {
template <typename T>
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 */
#endif /* mozilla_TypeTraits_h */

View file

@ -4,11 +4,12 @@
* 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/. */
#include <type_traits>
#include "mozilla/Assertions.h"
#include "mozilla/TypeTraits.h"
using mozilla::IsDestructible;
using mozilla::IsSame;
class PublicDestructible {
public:
@ -35,9 +36,9 @@ static_assert(IsDestructible<TrivialDestructible>::value,
* actual type sizes seen at compile time.
*/
#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");
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");
#endif

View file

@ -19,6 +19,7 @@
# include "mozilla/StackWalk.h"
# include <ostream>
# include <type_traits>
namespace mozilla {
namespace baseprofiler {
@ -152,7 +153,7 @@ class MOZ_RAII AutoArraySchemaWriter {
template <typename T>
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");
FillUpTo(aIndex);
mJSONWriter.IntElement(static_cast<int64_t>(aValue));

View file

@ -20,6 +20,7 @@
#include "ProfilerCodeAddressService.h"
#include <ostream>
#include <type_traits>
using namespace mozilla;
@ -161,7 +162,7 @@ class MOZ_RAII AutoArraySchemaWriter {
template <typename T>
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");
FillUpTo(aIndex);
mJSONWriter.IntElement(static_cast<int64_t>(aValue));

View file

@ -84,6 +84,7 @@
#include <fstream>
#include <ostream>
#include <sstream>
#include <type_traits>
#ifdef MOZ_TASK_TRACER
# include "GeckoTaskTracer.h"
@ -2790,8 +2791,8 @@ class SamplerThread {
// It may be tempting for a future maintainer to change aCallbacks into an
// rvalue reference; this will remind them not to do that!
static_assert(
IsSame<decltype(aCallbacks),
UniquePtr<PostSamplingCallbackListItem>>::value,
std::is_same_v<decltype(aCallbacks),
UniquePtr<PostSamplingCallbackListItem>>,
"We need to capture the list by-value, to implicitly destroy it");
}