Bug 1607595 - Remove uses of mozilla::IsBaseOf. r=froydnj

Automatically generated by:

$ rg 'IsBaseOf<' | cut -d : -f 1 | xargs sed -i 's/mozilla::IsBaseOf</std::is_base_of</g'
$ rg 'IsBaseOf<' | cut -d : -f 1 | xargs sed -i 's/IsBaseOf</std::is_base_of</g

Differential Revision: https://phabricator.services.mozilla.com/D59013

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-01-08 14:52:10 +00:00
parent 40a21eea5b
commit e363a41bd4
42 changed files with 151 additions and 148 deletions

View File

@ -81,7 +81,7 @@ class DocProxyAccessibleWrap : public HyperTextProxyAccessibleWrap {
template <typename T>
inline ProxyAccessible* HyperTextProxyFor(T* aWrapper) {
static_assert(mozilla::IsBaseOf<IUnknown, T>::value,
static_assert(std::is_base_of<IUnknown, T>::value,
"only IAccessible* should be passed in");
auto wrapper = static_cast<HyperTextProxyAccessibleWrap*>(aWrapper);
return wrapper->IsProxy() ? wrapper->Proxy() : nullptr;

View File

@ -61,13 +61,13 @@ struct DictionaryBase {
};
template <typename T>
inline typename EnableIf<IsBaseOf<DictionaryBase, T>::value, void>::Type
inline typename EnableIf<std::is_base_of<DictionaryBase, T>::value, void>::Type
ImplCycleCollectionUnlink(T& aDictionary) {
aDictionary.UnlinkForCC();
}
template <typename T>
inline typename EnableIf<IsBaseOf<DictionaryBase, T>::value, void>::Type
inline typename EnableIf<std::is_base_of<DictionaryBase, T>::value, void>::Type
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
T& aDictionary, const char* aName,
uint32_t aFlags = 0) {

View File

@ -823,7 +823,7 @@ struct IsRefcounted {
// This struct only works if T is fully declared (not just forward declared).
// The IsBaseOf check will ensure that, we don't really need it for any other
// reason (the static assert will of course always be true).
static_assert(!IsBaseOf<nsISupports, T>::value || IsRefcounted::value,
static_assert(!std::is_base_of<nsISupports, T>::value || IsRefcounted::value,
"Classes derived from nsISupports are refcounted!");
};
@ -832,7 +832,7 @@ struct IsRefcounted {
#undef HAS_MEMBER_TYPEDEFS
#ifdef DEBUG
template <class T, bool isISupports = IsBaseOf<nsISupports, T>::value>
template <class T, bool isISupports = std::is_base_of<nsISupports, T>::value>
struct CheckWrapperCacheCast {
static bool Check() {
return reinterpret_cast<uintptr_t>(
@ -982,13 +982,13 @@ template <class T>
struct TypeNeedsOuterization {
// We only need to outerize Window objects, so anything inheriting from
// nsGlobalWindow (which inherits from EventTarget itself).
static const bool value = IsBaseOf<nsGlobalWindowInner, T>::value ||
IsBaseOf<nsGlobalWindowOuter, T>::value ||
static const bool value = std::is_base_of<nsGlobalWindowInner, T>::value ||
std::is_base_of<nsGlobalWindowOuter, T>::value ||
IsSame<EventTarget, T>::value;
};
#ifdef DEBUG
template <typename T, bool isISupports = IsBaseOf<nsISupports, T>::value>
template <typename T, bool isISupports = std::is_base_of<nsISupports, T>::value>
struct CheckWrapperCacheTracing {
static inline void Check(T* aObject) {}
};
@ -1058,7 +1058,7 @@ MOZ_ALWAYS_INLINE bool DoGetOrCreateDOMReflector(
}
#ifdef DEBUG
if (IsBaseOf<nsWrapperCache, T>::value) {
if (std::is_base_of<nsWrapperCache, T>::value) {
CheckWrapperCacheTracing<T>::Check(value);
}
#endif
@ -1076,7 +1076,7 @@ MOZ_ALWAYS_INLINE bool DoGetOrCreateDOMReflector(
// reinterpret_castable to nsWrapperCache.
MOZ_ASSERT(clasp, "What happened here?");
MOZ_ASSERT_IF(clasp->mDOMObjectIsISupports,
(IsBaseOf<nsISupports, T>::value));
(std::is_base_of<nsISupports, T>::value));
MOZ_ASSERT(CheckWrapperCacheCast<T>::Check());
}
#endif
@ -1907,9 +1907,10 @@ void DoTraceSequence(JSTracer* trc, nsTArray<T>& seq);
// Class used to trace sequences, with specializations for various
// sequence types.
template <typename T, bool isDictionary = IsBaseOf<DictionaryBase, T>::value,
bool isTypedArray = IsBaseOf<AllTypedArraysBase, T>::value,
bool isOwningUnion = IsBaseOf<AllOwningUnionBase, T>::value>
template <typename T,
bool isDictionary = std::is_base_of<DictionaryBase, T>::value,
bool isTypedArray = std::is_base_of<AllTypedArraysBase, T>::value,
bool isOwningUnion = std::is_base_of<AllOwningUnionBase, T>::value>
class SequenceTracer {
explicit SequenceTracer() = delete; // Should never be instantiated
};
@ -2529,7 +2530,7 @@ inline bool UTF8StringToJsval(JSContext* cx, const nsACString& str,
return NonVoidUTF8StringToJsval(cx, str, rval);
}
template <class T, bool isISupports = IsBaseOf<nsISupports, T>::value>
template <class T, bool isISupports = std::is_base_of<nsISupports, T>::value>
struct PreserveWrapperHelper {
static void PreserveWrapper(T* aObject) {
aObject->PreserveWrapper(aObject, NS_CYCLE_COLLECTION_PARTICIPANT(T));
@ -2548,7 +2549,7 @@ void PreserveWrapper(T* aObject) {
PreserveWrapperHelper<T>::PreserveWrapper(aObject);
}
template <class T, bool isISupports = IsBaseOf<nsISupports, T>::value>
template <class T, bool isISupports = std::is_base_of<nsISupports, T>::value>
struct CastingAssertions {
static bool ToSupportsIsCorrect(T*) { return true; }
static bool ToSupportsIsOnPrimaryInheritanceChain(T*, nsWrapperCache*) {
@ -2663,7 +2664,7 @@ class MOZ_STACK_CLASS BindingJSObjectCreator {
struct OwnedNative {
// Make sure the native objects inherit from NonRefcountedDOMObject so
// that we log their ctor and dtor.
static_assert(IsBaseOf<NonRefcountedDOMObject, T>::value,
static_assert(std::is_base_of<NonRefcountedDOMObject, T>::value,
"Non-refcounted objects with DOM bindings should inherit "
"from NonRefcountedDOMObject.");
@ -2699,7 +2700,7 @@ struct DeferredFinalizerImpl {
typedef SegmentedVector<SmartPtr> SmartPtrArray;
static_assert(
IsSame<T, nsISupports>::value || !IsBaseOf<nsISupports, T>::value,
IsSame<T, nsISupports>::value || !std::is_base_of<nsISupports, T>::value,
"nsISupports classes should all use the nsISupports instantiation");
static inline void AppendAndTake(
@ -2742,7 +2743,7 @@ struct DeferredFinalizerImpl {
}
};
template <class T, bool isISupports = IsBaseOf<nsISupports, T>::value>
template <class T, bool isISupports = std::is_base_of<nsISupports, T>::value>
struct DeferredFinalizer {
static void AddForDeferredFinalization(T* aObject) {
typedef DeferredFinalizerImpl<T> Impl;
@ -2766,7 +2767,7 @@ static void AddForDeferredFinalization(T* aObject) {
// This returns T's CC participant if it participates in CC and does not inherit
// from nsISupports. Otherwise, it returns null. QI should be used to get the
// participant if T inherits from nsISupports.
template <class T, bool isISupports = IsBaseOf<nsISupports, T>::value>
template <class T, bool isISupports = std::is_base_of<nsISupports, T>::value>
class GetCCParticipant {
// Helper for GetCCParticipant for classes that participate in CC.
template <class U>
@ -2825,8 +2826,8 @@ struct CreateGlobalOptionsWithXPConnect {
template <class T>
using IsGlobalWithXPConnect =
IntegralConstant<bool, IsBaseOf<nsGlobalWindowInner, T>::value ||
IsBaseOf<MessageManagerGlobal, T>::value>;
IntegralConstant<bool, std::is_base_of<nsGlobalWindowInner, T>::value ||
std::is_base_of<MessageManagerGlobal, T>::value>;
template <class T>
struct CreateGlobalOptions : Conditional<IsGlobalWithXPConnect<T>::value,

View File

@ -440,7 +440,7 @@ def DOMClass(descriptor):
return fill(
"""
{ ${protoChain} },
IsBaseOf<nsISupports, ${nativeType} >::value,
std::is_base_of<nsISupports, ${nativeType} >::value,
${hooks},
FindAssociatedGlobalForNative<${nativeType}>::Get,
GetProtoObjectHandle,
@ -3887,7 +3887,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
return fill(
"""
static_assert(!IsBaseOf<NonRefcountedDOMObject, ${nativeType}>::value,
static_assert(!std::is_base_of<NonRefcountedDOMObject, ${nativeType}>::value,
"Shouldn't have wrappercached things that are not refcounted.");
$*{assertInheritance}
MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
@ -13607,7 +13607,7 @@ class CGDescriptor(CGThing):
if descriptor.proxy:
cgThings.append(CGGeneric(fill(
"""
static_assert(IsBaseOf<nsISupports, ${nativeType} >::value,
static_assert(std::is_base_of<nsISupports, ${nativeType} >::value,
"We don't support non-nsISupports native classes for "
"proxy-based bindings yet");

View File

@ -118,8 +118,10 @@ MOZ_MUST_USE inline bool ToJSValue(JSContext* aCx, CallbackObject& aArgument,
// Accept objects that inherit from nsWrapperCache (e.g. most
// DOM objects).
template <class T>
MOZ_MUST_USE typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type
ToJSValue(JSContext* aCx, T& aArgument, JS::MutableHandle<JS::Value> aValue) {
MOZ_MUST_USE
typename EnableIf<std::is_base_of<nsWrapperCache, T>::value, bool>::Type
ToJSValue(JSContext* aCx, T& aArgument,
JS::MutableHandle<JS::Value> aValue) {
// Make sure we're called in a compartment
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx));
@ -132,7 +134,8 @@ ToJSValue(JSContext* aCx, T& aArgument, JS::MutableHandle<JS::Value> aValue) {
namespace binding_detail {
template <class T>
MOZ_MUST_USE
typename EnableIf<IsBaseOf<NonRefcountedDOMObject, T>::value, bool>::Type
typename EnableIf<std::is_base_of<NonRefcountedDOMObject, T>::value,
bool>::Type
ToJSValueFromPointerHelper(JSContext* aCx, T* aArgument,
JS::MutableHandle<JS::Value> aValue) {
// Make sure we're called in a compartment
@ -160,7 +163,8 @@ MOZ_MUST_USE
// nsAutoPtr.
template <class T>
MOZ_MUST_USE
typename EnableIf<IsBaseOf<NonRefcountedDOMObject, T>::value, bool>::Type
typename EnableIf<std::is_base_of<NonRefcountedDOMObject, T>::value,
bool>::Type
ToJSValue(JSContext* aCx, nsAutoPtr<T>&& aArgument,
JS::MutableHandle<JS::Value> aValue) {
if (!binding_detail::ToJSValueFromPointerHelper(aCx, aArgument.get(),
@ -177,7 +181,8 @@ MOZ_MUST_USE
// UniquePtr.
template <class T>
MOZ_MUST_USE
typename EnableIf<IsBaseOf<NonRefcountedDOMObject, T>::value, bool>::Type
typename EnableIf<std::is_base_of<NonRefcountedDOMObject, T>::value,
bool>::Type
ToJSValue(JSContext* aCx, UniquePtr<T>&& aArgument,
JS::MutableHandle<JS::Value> aValue) {
if (!binding_detail::ToJSValueFromPointerHelper(aCx, aArgument.get(),
@ -193,7 +198,7 @@ MOZ_MUST_USE
// Accept typed arrays built from appropriate nsTArray values
template <typename T>
MOZ_MUST_USE
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
typename EnableIf<std::is_base_of<AllTypedArraysBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx, const TypedArrayCreator<T>& aArgument,
JS::MutableHandle<JS::Value> aValue) {
// Make sure we're called in a compartment
@ -210,9 +215,9 @@ MOZ_MUST_USE
// Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
// DOM File).
template <class T>
MOZ_MUST_USE typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
!IsBaseOf<CallbackObject, T>::value &&
IsBaseOf<nsISupports, T>::value,
MOZ_MUST_USE typename EnableIf<!std::is_base_of<nsWrapperCache, T>::value &&
!std::is_base_of<CallbackObject, T>::value &&
std::is_base_of<nsISupports, T>::value,
bool>::Type
ToJSValue(JSContext* aCx, T& aArgument, JS::MutableHandle<JS::Value> aValue) {
// Make sure we're called in a compartment
@ -247,7 +252,8 @@ MOZ_MUST_USE bool ToJSValue(JSContext* aCx, const NonNull<T>& aArgument,
// Accept WebIDL dictionaries
template <class T>
MOZ_MUST_USE typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type
MOZ_MUST_USE
typename EnableIf<std::is_base_of<DictionaryBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx, const T& aArgument,
JS::MutableHandle<JS::Value> aValue) {
return aArgument.ToObjectInternal(aCx, aValue);
@ -306,7 +312,7 @@ MOZ_MUST_USE bool ToJSValue(JSContext* aCx, ErrorResult& aArgument,
// Accept owning WebIDL unions.
template <typename T>
MOZ_MUST_USE
typename EnableIf<IsBaseOf<AllOwningUnionBase, T>::value, bool>::Type
typename EnableIf<std::is_base_of<AllOwningUnionBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx, const T& aArgument,
JS::MutableHandle<JS::Value> aValue) {
JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));

View File

@ -68,7 +68,7 @@ class CommandBufferBuilder {
/// This must be used between BeginCommandBuffer and EndCommandBuffer.
template <typename T, typename... Args>
ptrdiff_t AddCommand(Args&&... aArgs) {
static_assert(IsBaseOf<DrawingCommand, T>::value,
static_assert(std::is_base_of<DrawingCommand, T>::value,
"T must derive from DrawingCommand");
return mCommands->mStorage.Alloc<T>(std::forward<Args>(aArgs)...);
}

View File

@ -322,8 +322,7 @@ class StackFrame {
template <typename T>
void construct(T* ptr) {
static_assert(
mozilla::IsBaseOf<BaseStackFrame, ConcreteStackFrame<T>>::value,
static_assert(std::is_base_of<BaseStackFrame, ConcreteStackFrame<T>>::value,
"ConcreteStackFrame<T> must inherit from BaseStackFrame");
static_assert(
sizeof(ConcreteStackFrame<T>) == sizeof(*base()),
@ -711,7 +710,7 @@ class Node {
static_assert(
sizeof(Concrete<T>) == sizeof(*base()),
"ubi::Base specializations must be the same size as ubi::Base");
static_assert(mozilla::IsBaseOf<Base, Concrete<T>>::value,
static_assert(std::is_base_of<Base, Concrete<T>>::value,
"ubi::Concrete<T> must inherit from ubi::Base");
Concrete<T>::construct(base(), ptr);
}

View File

@ -789,7 +789,7 @@ BinASTParserPerTokenizer<Tok>::asFinalParser() {
// Same as GeneralParser::asFinalParser, verify the inheritance to
// make sure the static downcast works.
static_assert(
mozilla::IsBaseOf<BinASTParserPerTokenizer<Tok>, FinalParser>::value,
std::is_base_of<BinASTParserPerTokenizer<Tok>, FinalParser>::value,
"inheritance relationship required by the static_cast<> below");
return static_cast<FinalParser*>(this);
@ -799,7 +799,7 @@ template <typename Tok>
inline const typename BinASTParserPerTokenizer<Tok>::FinalParser*
BinASTParserPerTokenizer<Tok>::asFinalParser() const {
static_assert(
mozilla::IsBaseOf<BinASTParserPerTokenizer<Tok>, FinalParser>::value,
std::is_base_of<BinASTParserPerTokenizer<Tok>, FinalParser>::value,
"inheritance relationship required by the static_cast<> below");
return static_cast<const FinalParser*>(this);

View File

@ -108,7 +108,7 @@ template <class ParseHandler, typename Unit>
inline typename GeneralParser<ParseHandler, Unit>::FinalParser*
GeneralParser<ParseHandler, Unit>::asFinalParser() {
static_assert(
mozilla::IsBaseOf<GeneralParser<ParseHandler, Unit>, FinalParser>::value,
std::is_base_of<GeneralParser<ParseHandler, Unit>, FinalParser>::value,
"inheritance relationship required by the static_cast<> below");
return static_cast<FinalParser*>(this);
@ -118,7 +118,7 @@ template <class ParseHandler, typename Unit>
inline const typename GeneralParser<ParseHandler, Unit>::FinalParser*
GeneralParser<ParseHandler, Unit>::asFinalParser() const {
static_assert(
mozilla::IsBaseOf<GeneralParser<ParseHandler, Unit>, FinalParser>::value,
std::is_base_of<GeneralParser<ParseHandler, Unit>, FinalParser>::value,
"inheritance relationship required by the static_cast<> below");
return static_cast<const FinalParser*>(this);

View File

@ -1825,7 +1825,7 @@ ParserAnyCharsAccess<Parser>::anyChars(const GeneralTokenStreamChars* ts) {
// member within.
static_assert(
mozilla::IsBaseOf<GeneralTokenStreamChars, TokenStreamSpecific>::value,
std::is_base_of<GeneralTokenStreamChars, TokenStreamSpecific>::value,
"the static_cast<> below assumes a base-class relationship");
const auto* tss = static_cast<const TokenStreamSpecific*>(ts);

View File

@ -1902,7 +1902,7 @@ class GeneralTokenStreamChars : public SpecializedTokenStreamCharsBase<Unit> {
TokenStreamSpecific* asSpecific() {
static_assert(
mozilla::IsBaseOf<GeneralTokenStreamChars, TokenStreamSpecific>::value,
std::is_base_of<GeneralTokenStreamChars, TokenStreamSpecific>::value,
"static_cast below presumes an inheritance relationship");
return static_cast<TokenStreamSpecific*>(this);

View File

@ -33,7 +33,7 @@ struct TaggedPtr<JS::Value> {
static JS::Value wrap(JS::BigInt* bi) { return JS::BigIntValue(bi); }
template <typename T>
static JS::Value wrap(T* priv) {
static_assert(mozilla::IsBaseOf<Cell, T>::value,
static_assert(std::is_base_of<Cell, T>::value,
"Type must be a GC thing derived from js::gc::Cell");
return JS::PrivateGCThingValue(priv);
}
@ -57,20 +57,20 @@ struct TaggedPtr<TaggedProto> {
template <typename T>
struct MightBeForwarded {
static_assert(mozilla::IsBaseOf<Cell, T>::value, "T must derive from Cell");
static_assert(std::is_base_of<Cell, T>::value, "T must derive from Cell");
static_assert(!mozilla::IsSame<Cell, T>::value &&
!mozilla::IsSame<TenuredCell, T>::value,
"T must not be Cell or TenuredCell");
static const bool value = mozilla::IsBaseOf<JSObject, T>::value ||
mozilla::IsBaseOf<Shape, T>::value ||
mozilla::IsBaseOf<BaseShape, T>::value ||
mozilla::IsBaseOf<JSString, T>::value ||
mozilla::IsBaseOf<JS::BigInt, T>::value ||
mozilla::IsBaseOf<JSScript, T>::value ||
mozilla::IsBaseOf<js::LazyScript, T>::value ||
mozilla::IsBaseOf<js::Scope, T>::value ||
mozilla::IsBaseOf<js::RegExpShared, T>::value;
static const bool value = std::is_base_of<JSObject, T>::value ||
std::is_base_of<Shape, T>::value ||
std::is_base_of<BaseShape, T>::value ||
std::is_base_of<JSString, T>::value ||
std::is_base_of<JS::BigInt, T>::value ||
std::is_base_of<JSScript, T>::value ||
std::is_base_of<js::LazyScript, T>::value ||
std::is_base_of<js::Scope, T>::value ||
std::is_base_of<js::RegExpShared, T>::value;
};
template <typename T>

View File

@ -3610,9 +3610,9 @@ static inline bool ShouldCheckMarkState(JSRuntime* rt, T** thingp) {
template <typename T>
struct MightBeNurseryAllocated {
static const bool value = mozilla::IsBaseOf<JSObject, T>::value ||
mozilla::IsBaseOf<JSString, T>::value ||
mozilla::IsBaseOf<JS::BigInt, T>::value;
static const bool value = std::is_base_of<JSObject, T>::value ||
std::is_base_of<JSString, T>::value ||
std::is_base_of<JS::BigInt, T>::value;
};
template <typename T>

View File

@ -22,7 +22,7 @@ struct InternalGCPointerPolicy : public JS::GCPointerPolicy<T> {
using Type = typename mozilla::RemovePointer<T>::Type;
#define IS_BASE_OF_OR(_1, BaseType, _2, _3) \
mozilla::IsBaseOf<BaseType, Type>::value ||
std::is_base_of<BaseType, Type>::value ||
static_assert(
JS_FOR_EACH_TRACEKIND(IS_BASE_OF_OR) false,
"InternalGCPointerPolicy must only be used for GC thing pointers");

View File

@ -68,7 +68,7 @@ template <typename T>
struct BaseGCType {
using type =
typename MapTraceKindToType<JS::MapTypeToTraceKind<T>::kind>::Type;
static_assert(mozilla::IsBaseOf<type, T>::value, "Failed to find base type");
static_assert(std::is_base_of<type, T>::value, "Failed to find base type");
};
// Our barrier templates are parameterized on the pointer types so that we can

View File

@ -265,10 +265,9 @@ bool JitRuntime::generateTrampolines(JSContext* cx) {
// The arguments rectifier has to use the same frame layout as the function
// frames it rectifies.
static_assert(mozilla::IsBaseOf<JitFrameLayout, RectifierFrameLayout>::value,
static_assert(std::is_base_of<JitFrameLayout, RectifierFrameLayout>::value,
"a rectifier frame can be used with jit frame");
static_assert(
mozilla::IsBaseOf<JitFrameLayout, WasmToJSJitFrameLayout>::value,
static_assert(std::is_base_of<JitFrameLayout, WasmToJSJitFrameLayout>::value,
"wasm frames simply are jit frames");
static_assert(sizeof(JitFrameLayout) == sizeof(WasmToJSJitFrameLayout),
"thus a rectifier frame can be used with a wasm frame");

View File

@ -226,7 +226,7 @@ class CodeGeneratorShared : public LElementVisitor {
template <typename T>
inline size_t allocateIC(const T& cache) {
static_assert(mozilla::IsBaseOf<IonIC, T>::value,
static_assert(std::is_base_of<IonIC, T>::value,
"T must inherit from IonIC");
size_t index;
masm.propagateOOM(

View File

@ -361,7 +361,7 @@ class BaseScopeData {};
template <class Data>
inline size_t SizeOfData(uint32_t numBindings) {
static_assert(mozilla::IsBaseOf<BaseScopeData, Data>::value,
static_assert(std::is_base_of<BaseScopeData, Data>::value,
"Data must be the correct sort of data, i.e. it must "
"inherit from BaseScopeData");
return sizeof(Data) +

View File

@ -230,7 +230,7 @@ inline GCPtrShape* DictionaryShapeLink::prevPtr() {
template <class ObjectSubclass>
/* static */ inline bool EmptyShape::ensureInitialCustomShape(
JSContext* cx, Handle<ObjectSubclass*> obj) {
static_assert(mozilla::IsBaseOf<JSObject, ObjectSubclass>::value,
static_assert(std::is_base_of<JSObject, ObjectSubclass>::value,
"ObjectSubclass must be a subclass of JSObject");
// If the provided object has a non-empty shape, it was given the cached

View File

@ -369,7 +369,7 @@ XrayTraits* GetXrayTraits(JSObject* obj);
template <typename Base, typename Traits>
class XrayWrapper : public Base {
static_assert(mozilla::IsBaseOf<js::BaseProxyHandler, Base>::value,
static_assert(std::is_base_of<js::BaseProxyHandler, Base>::value,
"Base *must* derive from js::BaseProxyHandler");
public:

View File

@ -127,9 +127,8 @@ class do_QueryFrameHelper {
template <class Src, class Dst>
struct FastQueryFrame<
Src, Dst,
typename mozilla::EnableIf<mozilla::IsBaseOf<nsIFrame, Src>::value>::Type,
typename mozilla::EnableIf<
mozilla::IsBaseOf<nsIFrame, Dst>::value>::Type> {
typename mozilla::EnableIf<std::is_base_of<nsIFrame, Src>::value>::Type,
typename mozilla::EnableIf<std::is_base_of<nsIFrame, Dst>::value>::Type> {
static Dst* QueryFrame(Src* aFrame) {
return nsQueryFrame::FrameIID(aFrame->mClass) == Dst::kFrameIID
? reinterpret_cast<Dst*>(aFrame)

View File

@ -131,7 +131,7 @@ struct AlignedChecker<AlignType, Pointee> {
* particular alignment).
*/
template <typename T, typename U>
inline typename EnableIf<IsSame<T, U>::value || IsBaseOf<T, U>::value ||
inline typename EnableIf<IsSame<T, U>::value || std::is_base_of<T, U>::value ||
IsVoid<T>::value,
bool>::Type
IsInRange(const T* aPtr, const U* aBegin, const U* aEnd) {

View File

@ -93,7 +93,7 @@ class DoublyLinkedListElement {
*/
template <typename T>
struct GetDoublyLinkedListElement {
static_assert(mozilla::IsBaseOf<DoublyLinkedListElement<T>, T>::value,
static_assert(std::is_base_of<DoublyLinkedListElement<T>, T>::value,
"You need your own specialization of GetDoublyLinkedListElement"
" or use a separate Trait.");
static DoublyLinkedListElement<T>& Get(T* aThis) { return *aThis; }

View File

@ -26,11 +26,11 @@ enum StorageType { AsBase, AsMember };
// The extra conditions on storage for B are necessary so that PairHelper won't
// ambiguously inherit from either A or B, such that one or the other base class
// would be inaccessible.
template <typename A, typename B,
detail::StorageType =
IsEmpty<A>::value ? detail::AsBase : detail::AsMember,
detail::StorageType = IsEmpty<B>::value && !IsBaseOf<A, B>::value &&
!IsBaseOf<B, A>::value
template <
typename A, typename B,
detail::StorageType = IsEmpty<A>::value ? detail::AsBase : detail::AsMember,
detail::StorageType = IsEmpty<B>::value && !std::is_base_of<A, B>::value &&
!std::is_base_of<B, A>::value
? detail::AsBase
: detail::AsMember>
struct PairHelper;

View File

@ -245,7 +245,7 @@ template <typename T>
class RefCounted : public detail::RefCounted<T, detail::NonAtomicRefCount> {
public:
~RefCounted() {
static_assert(IsBaseOf<RefCounted, T>::value,
static_assert(std::is_base_of<RefCounted, T>::value,
"T must derive from RefCounted<T>");
}
};
@ -266,7 +266,7 @@ class AtomicRefCounted
Recording> {
public:
~AtomicRefCounted() {
static_assert(IsBaseOf<AtomicRefCounted, T>::value,
static_assert(std::is_base_of<AtomicRefCounted, T>::value,
"T must derive from AtomicRefCounted<T>");
}
};

View File

@ -221,7 +221,7 @@ class SupportsThreadSafeWeakPtr : public external::AtomicRefCounted<T> {
// that the object may be of an actual derived type U, but the weak reference
// is created for the supplied type T of SupportsThreadSafeWeakPtr<T>.
already_AddRefed<ThreadSafeWeakReference> getThreadSafeWeakReference() {
static_assert(IsBaseOf<SupportsThreadSafeWeakPtr<T>, T>::value,
static_assert(std::is_base_of<SupportsThreadSafeWeakPtr<T>, T>::value,
"T must derive from SupportsThreadSafeWeakPtr<T>");
if (!mRef) {
@ -312,8 +312,8 @@ class ThreadSafeWeakPtr {
private:
// Gets a new strong reference of the proper type T to the tracked object.
already_AddRefed<T> getRefPtr() const {
static_assert(
IsBaseOf<typename ThreadSafeWeakReference::ElementType, T>::value,
static_assert(std::is_base_of<typename ThreadSafeWeakReference::ElementType,
T>::value,
"T must derive from ThreadSafeWeakReference::ElementType");
return mRef ? mRef->getRefPtr().template downcast<T>() : nullptr;
}
@ -322,8 +322,8 @@ class ThreadSafeWeakPtr {
// Note that this operation is unsafe as it may cause races if downwind
// code depends on the value not to change after reading.
T* get() const {
static_assert(
IsBaseOf<typename ThreadSafeWeakReference::ElementType, T>::value,
static_assert(std::is_base_of<typename ThreadSafeWeakReference::ElementType,
T>::value,
"T must derive from ThreadSafeWeakReference::ElementType");
return mRef ? static_cast<T*>(mRef->get()) : nullptr;
}

View File

@ -728,9 +728,9 @@ struct BaseOfTester<Type, const Type> : TrueType {};
* class B : public A {};
* class C {};
*
* mozilla::IsBaseOf<A, A>::value is true;
* mozilla::IsBaseOf<A, B>::value is true;
* mozilla::IsBaseOf<A, C>::value is false;
* std::is_base_of<A, A>::value is true;
* std::is_base_of<A, B>::value is true;
* std::is_base_of<A, C>::value is false;
*/
template <class Base, class Derived>
struct IsBaseOf

View File

@ -215,7 +215,7 @@ template <typename T>
class SupportsWeakPtr {
protected:
~SupportsWeakPtr() {
static_assert(IsBaseOf<SupportsWeakPtr<T>, T>::value,
static_assert(std::is_base_of<SupportsWeakPtr<T>, T>::value,
"T must derive from SupportsWeakPtr<T>");
if (mSelfReferencingWeakPtr) {
mSelfReferencingWeakPtr.mRef->detach();

View File

@ -427,22 +427,23 @@ struct B2 : B {};
struct D : private B1, private B2 {};
static void StandardIsBaseOfTests() {
static_assert((IsBaseOf<B, D>::value) == true, "IsBaseOf fails on diamond");
static_assert((IsBaseOf<const B, D>::value) == true,
static_assert((std::is_base_of<B, D>::value) == true,
"IsBaseOf fails on diamond");
static_assert((std::is_base_of<const B, D>::value) == true,
"IsBaseOf fails on diamond plus constness change");
static_assert((IsBaseOf<B, const D>::value) == true,
static_assert((std::is_base_of<B, const D>::value) == true,
"IsBaseOf fails on diamond plus constness change");
static_assert((IsBaseOf<B, const B>::value) == true,
static_assert((std::is_base_of<B, const B>::value) == true,
"IsBaseOf fails on constness change");
static_assert((IsBaseOf<D, B>::value) == false,
static_assert((std::is_base_of<D, B>::value) == false,
"IsBaseOf got the direction of inheritance wrong");
static_assert((IsBaseOf<B&, D&>::value) == false,
static_assert((std::is_base_of<B&, D&>::value) == false,
"IsBaseOf should return false on references");
static_assert((IsBaseOf<B[3], D[3]>::value) == false,
static_assert((std::is_base_of<B[3], D[3]>::value) == false,
"IsBaseOf should return false on arrays");
// We fail at the following test. To fix it, we need to specialize IsBaseOf
// for all built-in types.
// static_assert((IsBaseOf<int, int>::value) == false);
// static_assert((std::is_base_of<int, int>::value) == false);
}
} /* namespace CPlusPlus11IsBaseOf */
@ -455,15 +456,15 @@ class E : public A {};
class F : public B, public E {};
static void TestIsBaseOf() {
static_assert((IsBaseOf<A, B>::value), "A is a base of B");
static_assert((!IsBaseOf<B, A>::value), "B is not a base of A");
static_assert((IsBaseOf<A, C>::value), "A is a base of C");
static_assert((!IsBaseOf<C, A>::value), "C is not a base of A");
static_assert((IsBaseOf<A, F>::value), "A is a base of F");
static_assert((!IsBaseOf<F, A>::value), "F is not a base of A");
static_assert((!IsBaseOf<A, D>::value), "A is not a base of D");
static_assert((!IsBaseOf<D, A>::value), "D is not a base of A");
static_assert((IsBaseOf<B, B>::value),
static_assert((std::is_base_of<A, B>::value), "A is a base of B");
static_assert((!std::is_base_of<B, A>::value), "B is not a base of A");
static_assert((std::is_base_of<A, C>::value), "A is a base of C");
static_assert((!std::is_base_of<C, A>::value), "C is not a base of A");
static_assert((std::is_base_of<A, F>::value), "A is a base of F");
static_assert((!std::is_base_of<F, A>::value), "F is not a base of A");
static_assert((!std::is_base_of<A, D>::value), "A is not a base of D");
static_assert((!std::is_base_of<D, A>::value), "D is not a base of A");
static_assert((std::is_base_of<B, B>::value),
"B is the same as B (and therefore, a base of B)");
}

View File

@ -128,7 +128,7 @@ enum NativePtrType { OWNING, WEAK, REFPTR };
template <class Impl>
class NativePtrPicker {
template <class I>
static typename EnableIf<IsBaseOf<SupportsWeakPtr<I>, I>::value,
static typename EnableIf<std::is_base_of<SupportsWeakPtr<I>, I>::value,
char (&)[NativePtrType::WEAK]>::Type
Test(char);

View File

@ -131,8 +131,8 @@ class nsAppShell : public nsBaseAppShell {
const mozilla::TimeDuration timeout = mozilla::TimeDuration::Forever());
template <typename T>
static typename mozilla::EnableIf<!mozilla::IsBaseOf<Event, T>::value,
void>::Type
static
typename mozilla::EnableIf<!std::is_base_of<Event, T>::value, void>::Type
SyncRunEvent(T&& lambda) {
SyncRunEvent(LambdaEvent<T>(std::forward<T>(lambda)));
}

View File

@ -25,7 +25,7 @@ void DropJSObjectsImpl(nsISupports* aHolder);
} // namespace cyclecollector
template <class T, bool isISupports = IsBaseOf<nsISupports, T>::value>
template <class T, bool isISupports = std::is_base_of<nsISupports, T>::value>
struct HoldDropJSObjectsHelper {
static void Hold(T* aHolder) {
cyclecollector::HoldJSObjectsImpl(aHolder,

View File

@ -485,8 +485,7 @@ class MOZ_IS_REFPTR nsCOMPtr final
MOZ_IMPLICIT nsCOMPtr(const nsCOMPtr<U>& aSmartPtr)
: NSCAP_CTOR_BASE(aSmartPtr.get()) {
// Make sure that U actually inherits from T
static_assert(mozilla::IsBaseOf<T, U>::value,
"U should be a subclass of T");
static_assert(std::is_base_of<T, U>::value, "U should be a subclass of T");
assert_validity();
if (mRawPtr) {
NSCAP_ADDREF(this, mRawPtr);
@ -504,8 +503,7 @@ class MOZ_IS_REFPTR nsCOMPtr final
MOZ_IMPLICIT nsCOMPtr(nsCOMPtr<U>&& aSmartPtr)
: NSCAP_CTOR_BASE(aSmartPtr.forget().template downcast<T>().take()) {
// Make sure that U actually inherits from T
static_assert(mozilla::IsBaseOf<T, U>::value,
"U should be a subclass of T");
static_assert(std::is_base_of<T, U>::value, "U should be a subclass of T");
assert_validity();
NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
NSCAP_ASSERT_NO_QUERY_NEEDED();
@ -541,7 +539,7 @@ class MOZ_IS_REFPTR nsCOMPtr final
: NSCAP_CTOR_BASE(static_cast<T*>(aSmartPtr.take())) {
assert_validity();
// But make sure that U actually inherits from T.
static_assert(mozilla::IsBaseOf<T, U>::value, "U is not a subclass of T");
static_assert(std::is_base_of<T, U>::value, "U is not a subclass of T");
NSCAP_LOG_ASSIGNMENT(this, static_cast<T*>(mRawPtr));
NSCAP_ASSERT_NO_QUERY_NEEDED();
}
@ -552,7 +550,7 @@ class MOZ_IS_REFPTR nsCOMPtr final
: NSCAP_CTOR_BASE(static_cast<T*>(aSmartPtr.take())) {
assert_validity();
// But make sure that U actually inherits from T.
static_assert(mozilla::IsBaseOf<T, U>::value, "U is not a subclass of T");
static_assert(std::is_base_of<T, U>::value, "U is not a subclass of T");
NSCAP_LOG_ASSIGNMENT(this, static_cast<T*>(mRawPtr));
NSCAP_ASSERT_NO_QUERY_NEEDED();
}
@ -647,8 +645,7 @@ class MOZ_IS_REFPTR nsCOMPtr final
template <class U>
nsCOMPtr<T>& operator=(const nsCOMPtr<U>& aRhs) {
// Make sure that U actually inherits from T
static_assert(mozilla::IsBaseOf<T, U>::value,
"U should be a subclass of T");
static_assert(std::is_base_of<T, U>::value, "U should be a subclass of T");
assign_with_AddRef(ToSupports(static_cast<T*>(aRhs.get())));
return *this;
}
@ -661,8 +658,7 @@ class MOZ_IS_REFPTR nsCOMPtr final
template <class U>
nsCOMPtr<T>& operator=(nsCOMPtr<U>&& aRhs) {
// Make sure that U actually inherits from T
static_assert(mozilla::IsBaseOf<T, U>::value,
"U should be a subclass of T");
static_assert(std::is_base_of<T, U>::value, "U should be a subclass of T");
assign_assuming_AddRef(aRhs.forget().template downcast<T>().take());
NSCAP_ASSERT_NO_QUERY_NEEDED();
return *this;
@ -683,7 +679,7 @@ class MOZ_IS_REFPTR nsCOMPtr final
template <typename U>
nsCOMPtr<T>& operator=(already_AddRefed<U>& aRhs) {
// Make sure that U actually inherits from T
static_assert(mozilla::IsBaseOf<T, U>::value, "U is not a subclass of T");
static_assert(std::is_base_of<T, U>::value, "U is not a subclass of T");
assign_assuming_AddRef(static_cast<T*>(aRhs.take()));
NSCAP_ASSERT_NO_QUERY_NEEDED();
return *this;
@ -693,7 +689,7 @@ class MOZ_IS_REFPTR nsCOMPtr final
template <typename U>
nsCOMPtr<T>& operator=(already_AddRefed<U>&& aRhs) {
// Make sure that U actually inherits from T
static_assert(mozilla::IsBaseOf<T, U>::value, "U is not a subclass of T");
static_assert(std::is_base_of<T, U>::value, "U is not a subclass of T");
assign_assuming_AddRef(static_cast<T*>(aRhs.take()));
NSCAP_ASSERT_NO_QUERY_NEEDED();
return *this;
@ -1156,7 +1152,7 @@ template <typename U>
void nsCOMPtr<T>::assign_from_qi(const nsQueryInterface<U> aQI,
const nsIID& aIID) {
static_assert(
!(mozilla::IsSame<T, U>::value || mozilla::IsBaseOf<T, U>::value),
!(mozilla::IsSame<T, U>::value || std::is_base_of<T, U>::value),
"don't use do_QueryInterface for compile-time-determinable casts");
void* newRawPtr;
if (NS_FAILED(aQI(aIID, &newRawPtr))) {
@ -1170,7 +1166,7 @@ template <typename U>
void nsCOMPtr<T>::assign_from_qi_with_error(
const nsQueryInterfaceWithError<U>& aQI, const nsIID& aIID) {
static_assert(
!(mozilla::IsSame<T, U>::value || mozilla::IsBaseOf<T, U>::value),
!(mozilla::IsSame<T, U>::value || std::is_base_of<T, U>::value),
"don't use do_QueryInterface for compile-time-determinable casts");
void* newRawPtr;
if (NS_FAILED(aQI(aIID, &newRawPtr))) {

View File

@ -48,7 +48,7 @@ nsISupports* ToSupports(
// The default implementation of this class template is empty, because it
// should never be used: see the partial specializations below.
template <typename T, bool IsXPCOM = mozilla::IsBaseOf<nsISupports, T>::value>
template <typename T, bool IsXPCOM = std::is_base_of<nsISupports, T>::value>
struct CycleCollectionNoteChildImpl {};
template <typename T>

View File

@ -347,7 +347,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsXPCOMCycleCollectionParticipant,
// The default implementation of this class template is empty, because it
// should never be used: see the partial specializations below.
template <typename T, bool IsXPCOM = mozilla::IsBaseOf<nsISupports, T>::value>
template <typename T, bool IsXPCOM = std::is_base_of<nsISupports, T>::value>
struct DowncastCCParticipantImpl {};
// Specialization for XPCOM CC participants

View File

@ -95,7 +95,7 @@ class nsAutoOwningThread {
"Token '" #_type "' is not a class type.")
# define MOZ_ASSERT_NOT_ISUPPORTS(_type) \
static_assert(!mozilla::IsBaseOf<nsISupports, _type>::value, \
static_assert(!std::is_base_of<nsISupports, _type>::value, \
"nsISupports classes don't need to call MOZ_COUNT_CTOR or " \
"MOZ_COUNT_DTOR");

View File

@ -120,7 +120,7 @@ inline nsresult CallQueryInterface(T* aSource, DestinationType** aDestination) {
// the canonical nsISupports pointer with CallQueryInterface.
static_assert(
!(mozilla::IsSame<DestinationType, T>::value ||
mozilla::IsBaseOf<DestinationType, T>::value) ||
std::is_base_of<DestinationType, T>::value) ||
mozilla::IsSame<DestinationType, nsISupports>::value,
"don't use CallQueryInterface for compile-time-determinable casts");

View File

@ -78,7 +78,7 @@ struct RemoveAlreadyAddRefed<already_AddRefed<T>> {
mozilla::IsSame<already_AddRefed<T>, decltype(_GetterProc())>::value, \
"Singleton constructor must return already_AddRefed"); \
static_assert( \
mozilla::IsBaseOf<_InstanceClass, T>::value, \
std::is_base_of<_InstanceClass, T>::value, \
"Singleton constructor must return correct already_AddRefed"); \
inst = _GetterProc(); \
if (nullptr == inst) { \

View File

@ -360,7 +360,7 @@ class ModuleEntry(object):
mozilla::IsSame<already_AddRefed<T>, decltype(%(constructor)s())>::value,
"Singleton constructor must return already_AddRefed");
static_assert(
mozilla::IsBaseOf<%(type)s, T>::value,
std::is_base_of<%(type)s, T>::value,
"Singleton constructor must return correct already_AddRefed");
""" % {'type': self.type, 'constructor': self.constructor}

View File

@ -50,7 +50,7 @@ ThreadEventQueue<InnerQueueT>::ThreadEventQueue(UniquePtr<InnerQueueT> aQueue)
: mBaseQueue(std::move(aQueue)),
mLock("ThreadEventQueue"),
mEventsAvailable(mLock, "EventsAvail") {
static_assert(IsBaseOf<AbstractEventQueue, InnerQueueT>::value,
static_assert(std::is_base_of<AbstractEventQueue, InnerQueueT>::value,
"InnerQueueT must be an AbstractEventQueue subclass");
}

View File

@ -127,8 +127,10 @@ template <class T>
inline NS_HIDDEN_(void)
NS_ProxyRelease(const char* aName, nsIEventTarget* aTarget,
already_AddRefed<T> aDoomed, bool aAlwaysProxy = false) {
::detail::ProxyReleaseChooser<mozilla::IsBaseOf<nsISupports, T>::value>::
ProxyRelease(aName, aTarget, std::move(aDoomed), aAlwaysProxy);
::detail::ProxyReleaseChooser<
std::is_base_of<nsISupports, T>::value>::ProxyRelease(aName, aTarget,
std::move(aDoomed),
aAlwaysProxy);
}
/**

View File

@ -810,7 +810,7 @@ template <typename PtrType, class C, typename R, bool Owning,
mozilla::RunnableKind Kind, typename... As>
struct nsRunnableMethodTraits<PtrType, R (C::*)(As...), Owning, Kind> {
typedef typename mozilla::RemoveRawOrSmartPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
static_assert(std::is_base_of<C, class_type>::value,
"Stored class must inherit from method's class");
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Kind> base_type;
@ -822,7 +822,7 @@ template <typename PtrType, class C, typename R, bool Owning,
struct nsRunnableMethodTraits<PtrType, R (C::*)(As...) const, Owning, Kind> {
typedef const typename mozilla::RemoveRawOrSmartPointer<PtrType>::Type
class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
static_assert(std::is_base_of<C, class_type>::value,
"Stored class must inherit from method's class");
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Kind> base_type;
@ -835,7 +835,7 @@ template <typename PtrType, class C, typename R, bool Owning,
struct nsRunnableMethodTraits<PtrType, R (__stdcall C::*)(As...), Owning,
Kind> {
typedef typename mozilla::RemoveRawOrSmartPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
static_assert(std::is_base_of<C, class_type>::value,
"Stored class must inherit from method's class");
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Kind> base_type;
@ -846,7 +846,7 @@ template <typename PtrType, class C, typename R, bool Owning,
mozilla::RunnableKind Kind>
struct nsRunnableMethodTraits<PtrType, R (NS_STDCALL C::*)(), Owning, Kind> {
typedef typename mozilla::RemoveRawOrSmartPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
static_assert(std::is_base_of<C, class_type>::value,
"Stored class must inherit from method's class");
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Kind> base_type;
@ -859,7 +859,7 @@ struct nsRunnableMethodTraits<PtrType, R (__stdcall C::*)(As...) const, Owning,
Kind> {
typedef const typename mozilla::RemoveRawOrSmartPointer<PtrType>::Type
class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
static_assert(std::is_base_of<C, class_type>::value,
"Stored class must inherit from method's class");
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Kind> base_type;
@ -872,7 +872,7 @@ struct nsRunnableMethodTraits<PtrType, R (NS_STDCALL C::*)() const, Owning,
Kind> {
typedef const typename mozilla::RemoveRawOrSmartPointer<PtrType>::Type
class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
static_assert(std::is_base_of<C, class_type>::value,
"Stored class must inherit from method's class");
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Kind> base_type;