diff --git a/js/src/builtin/String.cpp b/js/src/builtin/String.cpp index 856f8608f35e..ec28f4f58b5f 100644 --- a/js/src/builtin/String.cpp +++ b/js/src/builtin/String.cpp @@ -2190,7 +2190,7 @@ int js::StringFindPattern(const JSLinearString* text, const JSLinearString* pat, return StringMatch(text, pat, start); } -typedef Vector LinearStringVector; +using LinearStringVector = Vector; template static int RopeMatchImpl(const AutoCheckCannotGC& nogc, diff --git a/js/src/debugger/Debugger.h b/js/src/debugger/Debugger.h index d9d06e685599..04022ec1f131 100644 --- a/js/src/debugger/Debugger.h +++ b/js/src/debugger/Debugger.h @@ -285,9 +285,9 @@ class Completion { Variant variant; }; -typedef HashSet, - StableCellHasher>, ZoneAllocPolicy> - WeakGlobalObjectSet; +using WeakGlobalObjectSet = + HashSet, + StableCellHasher>, ZoneAllocPolicy>; #ifdef DEBUG extern void CheckDebuggeeThing(BaseScript* script, bool invisibleOk); @@ -344,7 +344,7 @@ class DebuggerWeakMap : private WeakMap, HeapPtr> { JS::Compartment* compartment; public: - typedef WeakMap Base; + using Base = WeakMap; using ReferentType = Referent; using WrapperType = Wrapper; @@ -466,8 +466,8 @@ using Env = JSObject; // does point to something okay. Instead, we immediately build an instance of // this type from the Cell* and use that instead, so we can benefit from // Variant's static checks. -typedef mozilla::Variant - DebuggerScriptReferent; +using DebuggerScriptReferent = + mozilla::Variant; // The referent of a Debugger.Source. // @@ -479,8 +479,8 @@ typedef mozilla::Variant // The DebuggerSource object actually simply stores a Cell* in its private // pointer. See the comments for DebuggerScriptReferent for the rationale for // this type. -typedef mozilla::Variant - DebuggerSourceReferent; +using DebuggerSourceReferent = + mozilla::Variant; template class MOZ_RAII DebuggerList { @@ -749,9 +749,8 @@ class Debugger : private mozilla::LinkedListElement { * that way, but since stack frames are not gc-things, the implementation * has to be different. */ - typedef HashMap, - DefaultHasher, ZoneAllocPolicy> - FrameMap; + using FrameMap = HashMap, + DefaultHasher, ZoneAllocPolicy>; FrameMap frames; /* @@ -778,8 +777,8 @@ class Debugger : private mozilla::LinkedListElement { * An entry in this table exists if and only if the Debugger.Frame's * GENERATOR_INFO_SLOT is set. */ - typedef DebuggerWeakMap - GeneratorWeakMap; + using GeneratorWeakMap = + DebuggerWeakMap; GeneratorWeakMap generatorFrames; // An ephemeral map from BaseScript* to Debugger.Script instances. @@ -790,28 +789,28 @@ class Debugger : private mozilla::LinkedListElement { // The map from debuggee source script objects to their Debugger.Source // instances. - typedef DebuggerWeakMap - SourceWeakMap; + using SourceWeakMap = + DebuggerWeakMap; SourceWeakMap sources; // The map from debuggee objects to their Debugger.Object instances. - typedef DebuggerWeakMap ObjectWeakMap; + using ObjectWeakMap = DebuggerWeakMap; ObjectWeakMap objects; // The map from debuggee Envs to Debugger.Environment instances. - typedef DebuggerWeakMap EnvironmentWeakMap; + using EnvironmentWeakMap = DebuggerWeakMap; EnvironmentWeakMap environments; // The map from WasmInstanceObjects to synthesized Debugger.Script // instances. - typedef DebuggerWeakMap - WasmInstanceScriptWeakMap; + using WasmInstanceScriptWeakMap = + DebuggerWeakMap; WasmInstanceScriptWeakMap wasmInstanceScripts; // The map from WasmInstanceObjects to synthesized Debugger.Source // instances. - typedef DebuggerWeakMap - WasmInstanceSourceWeakMap; + using WasmInstanceSourceWeakMap = + DebuggerWeakMap; WasmInstanceSourceWeakMap wasmInstanceSources; class QueryBase; diff --git a/js/src/frontend/BytecodeSection.h b/js/src/frontend/BytecodeSection.h index 0e7ed3d44756..cee8e29ef843 100644 --- a/js/src/frontend/BytecodeSection.h +++ b/js/src/frontend/BytecodeSection.h @@ -172,8 +172,8 @@ static constexpr size_t MaxSrcNotesLength = INT32_MAX; // Have a few inline elements, so as to avoid heap allocation for tiny // sequences. See bug 1390526. -typedef Vector BytecodeVector; -typedef Vector SrcNotesVector; +using BytecodeVector = Vector; +using SrcNotesVector = Vector; // Bytecode and all data directly associated with specific opcode/index inside // bytecode is stored in this class. diff --git a/js/src/irregexp/RegExpAPI.cpp b/js/src/irregexp/RegExpAPI.cpp index b2f0c80643f8..c6a8da3ab789 100644 --- a/js/src/irregexp/RegExpAPI.cpp +++ b/js/src/irregexp/RegExpAPI.cpp @@ -886,7 +886,7 @@ RegExpRunStatus ExecuteRaw(jit::JitCode* code, const CharT* chars, static_assert(static_cast(RegExpRunStatus::Success_NotFound) == v8::internal::RegExp::kInternalRegExpFailure); - typedef int (*RegExpCodeSignature)(InputOutputData*); + using RegExpCodeSignature = int (*)(InputOutputData*); auto function = reinterpret_cast(code->raw()); { JS::AutoSuppressGCAnalysis nogc; diff --git a/js/src/jsapi-tests/testAssemblerBuffer.cpp b/js/src/jsapi-tests/testAssemblerBuffer.cpp index 50fc5b6043fb..0eb2bf8a5dbc 100644 --- a/js/src/jsapi-tests/testAssemblerBuffer.cpp +++ b/js/src/jsapi-tests/testAssemblerBuffer.cpp @@ -42,7 +42,7 @@ END_TEST(testAssemblerBuffer_BufferOffset) BEGIN_TEST(testAssemblerBuffer_AssemblerBuffer) { using js::jit::BufferOffset; - typedef js::jit::AssemblerBuffer<5 * sizeof(uint32_t), uint32_t> AsmBuf; + using AsmBuf = js::jit::AssemblerBuffer<5 * sizeof(uint32_t), uint32_t>; AsmBuf ab; CHECK(ab.isAligned(16)); @@ -107,7 +107,7 @@ BEGIN_TEST(testAssemblerBuffer_AssemblerBuffer) { END_TEST(testAssemblerBuffer_AssemblerBuffer) BEGIN_TEST(testAssemblerBuffer_BranchDeadlineSet) { - typedef js::jit::BranchDeadlineSet<3> DLSet; + using DLSet = js::jit::BranchDeadlineSet<3>; using js::jit::BufferOffset; js::LifoAlloc alloc(1024); @@ -217,13 +217,12 @@ namespace { struct TestAssembler; -typedef js::jit::AssemblerBufferWithConstantPools< +using AsmBufWithPool = js::jit::AssemblerBufferWithConstantPools< /* SliceSize */ 5 * sizeof(uint32_t), /* InstSize */ 4, /* Inst */ uint32_t, /* Asm */ TestAssembler, - /* NumShortBranchRanges */ 3> - AsmBufWithPool; + /* NumShortBranchRanges */ 3>; struct TestAssembler { // Mock instruction set: diff --git a/js/src/jsapi-tests/testHashTable.cpp b/js/src/jsapi-tests/testHashTable.cpp index 4cd55f4cba73..5996a1b5300c 100644 --- a/js/src/jsapi-tests/testHashTable.cpp +++ b/js/src/jsapi-tests/testHashTable.cpp @@ -13,12 +13,10 @@ // #define FUZZ -typedef js::HashMap, - js::SystemAllocPolicy> - IntMap; -typedef js::HashSet, - js::SystemAllocPolicy> - IntSet; +using IntMap = js::HashMap, + js::SystemAllocPolicy>; +using IntSet = + js::HashSet, js::SystemAllocPolicy>; /* * The rekeying test as conducted by adding only keys masked with 0x0000FFFF @@ -314,7 +312,7 @@ struct MoveOnlyType { } struct HashPolicy { - typedef MoveOnlyType Lookup; + using Lookup = MoveOnlyType; static js::HashNumber hash(const Lookup& lookup) { return lookup.val; } @@ -329,9 +327,8 @@ struct MoveOnlyType { }; BEGIN_TEST(testHashSetOfMoveOnlyType) { - typedef js::HashSet - Set; + using Set = js::HashSet; Set set; diff --git a/js/src/jsapi-tests/testsJit.h b/js/src/jsapi-tests/testsJit.h index 0984e71c9628..84bf843f5df7 100644 --- a/js/src/jsapi-tests/testsJit.h +++ b/js/src/jsapi-tests/testsJit.h @@ -9,7 +9,7 @@ #include "jit/MacroAssembler.h" -typedef void (*EnterTest)(); +using EnterTest = void (*)(); // On entry to the JIT code, save every register. void PrepareJit(js::jit::MacroAssembler& masm); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 3b3717943406..1dcf2ea0201c 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -816,12 +816,12 @@ JS_PUBLIC_API bool JS_RefreshCrossCompartmentWrappers(JSContext* cx, return RemapAllWrappersForObject(cx, obj, obj); } -typedef struct JSStdName { +struct JSStdName { size_t atomOffset; /* offset of atom pointer in JSAtomState */ JSProtoKey key; bool isDummy() const { return key == JSProto_Null; } bool isSentinel() const { return key == JSProto_LIMIT; } -} JSStdName; +}; static const JSStdName* LookupStdName(const JSAtomState& names, JSAtom* name, const JSStdName* table) { diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 4dee11d9f3fd..7605f90cf321 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -506,15 +506,12 @@ extern JS_PUBLIC_API JSLinearString* GetErrorTypeName(JSContext* cx, int16_t exnType); /* Implemented in CrossCompartmentWrapper.cpp. */ -typedef enum NukeReferencesToWindow { - NukeWindowReferences, - DontNukeWindowReferences -} NukeReferencesToWindow; +enum NukeReferencesToWindow { NukeWindowReferences, DontNukeWindowReferences }; -typedef enum NukeReferencesFromTarget { +enum NukeReferencesFromTarget { NukeAllReferences, NukeIncomingReferences, -} NukeReferencesFromTarget; +}; /* * These filters are designed to be ephemeral stack classes, and thus don't @@ -709,8 +706,8 @@ extern JS_PUBLIC_API bool IsSavedFrame(JSObject* obj); #if defined(XP_WIN) // Parameters use void* types to avoid #including windows.h. The return value of // this function is returned from the exception handler. -typedef long (*JitExceptionHandler)(void* exceptionRecord, // PEXECTION_RECORD - void* context); // PCONTEXT +using JitExceptionHandler = long (*)(void* exceptionRecord, // PEXECTION_RECORD + void* context); // PCONTEXT /** * Windows uses "structured exception handling" to handle faults. When a fault diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 712db681d3b1..5960982ad01e 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -1724,7 +1724,7 @@ static bool AddIntlExtras(JSContext* cx, unsigned argc, Value* vp) { * coincides with the end of a line. */ int startline = lineno; - typedef Vector CharBuffer; + using CharBuffer = Vector; RootedObject globalLexical(cx, &cx->global()->lexicalEnvironment()); CharBuffer buffer(cx); do { @@ -4127,12 +4127,12 @@ static bool CreateErrorReport(JSContext* cx, unsigned argc, Value* vp) { #define LAZY_STANDARD_CLASSES /* A class for easily testing the inner/outer object callbacks. */ -typedef struct ComplexObject { +struct ComplexObject { bool isInner; bool frozen; JSObject* inner; JSObject* outer; -} ComplexObject; +}; static bool sandbox_enumerate(JSContext* cx, JS::HandleObject obj, JS::MutableHandleIdVector properties, @@ -7545,7 +7545,7 @@ struct SharedObjectMailbox { Value val; }; -typedef ExclusiveData SOMailbox; +using SOMailbox = ExclusiveData; // Never null after successful initialization. static SOMailbox* sharedObjectMailbox; @@ -7769,11 +7769,11 @@ static bool SetSharedObject(JSContext* cx, unsigned argc, Value* vp) { return true; } -typedef Vector Uint8Vector; +using Uint8Vector = Vector; class StreamCacheEntry : public AtomicRefCounted, public JS::OptimizedEncodingListener { - typedef AtomicRefCounted AtomicBase; + using AtomicBase = AtomicRefCounted; Uint8Vector bytes_; ExclusiveData optimized_; @@ -7819,7 +7819,7 @@ class StreamCacheEntry : public AtomicRefCounted, } }; -typedef RefPtr StreamCacheEntryPtr; +using StreamCacheEntryPtr = RefPtr; class StreamCacheEntryObject : public NativeObject { static const unsigned CACHE_ENTRY_SLOT = 0; diff --git a/js/src/shell/jsoptparse.h b/js/src/shell/jsoptparse.h index 34f46fed489f..0ab53ca57fd1 100644 --- a/js/src/shell/jsoptparse.h +++ b/js/src/shell/jsoptparse.h @@ -187,7 +187,7 @@ struct MultiStringOption : public ValuedOption { } /* namespace detail */ class MultiStringRange { - typedef detail::StringArg StringArg; + using StringArg = detail::StringArg; const StringArg* cur; const StringArg* end; @@ -233,9 +233,9 @@ class OptionParser { }; private: - typedef Vector Options; - typedef detail::Option Option; - typedef detail::BoolOption BoolOption; + using Options = Vector; + using Option = detail::Option; + using BoolOption = detail::BoolOption; Options options; Options arguments; diff --git a/js/src/threading/ProtectedData.h b/js/src/threading/ProtectedData.h index bff58a871c6d..8f3cac56c8d2 100644 --- a/js/src/threading/ProtectedData.h +++ b/js/src/threading/ProtectedData.h @@ -75,7 +75,7 @@ class MOZ_RAII AutoNoteSingleThreadedRegion { // occur when the data is both read from and written to. template class ProtectedData { - typedef ProtectedData ThisType; + using ThisType = ProtectedData; public: template @@ -302,7 +302,7 @@ using HelperThreadLockData = ProtectedDataNoCheckArgs< // initialized, as such guarantees are not provided by this class. template class ProtectedDataWriteOnce { - typedef ProtectedDataWriteOnce ThisType; + using ThisType = ProtectedDataWriteOnce; public: template diff --git a/js/src/wasm/WasmUtility.h b/js/src/wasm/WasmUtility.h index 58b5c673f922..de157265e1ac 100644 --- a/js/src/wasm/WasmUtility.h +++ b/js/src/wasm/WasmUtility.h @@ -28,7 +28,7 @@ static inline bool EqualContainers(const Container1& lhs, "Must be trivially destructible"); \ namespace js { \ namespace wasm { \ - typedef Vector VectorName; + using VectorName = Vector; using mozilla::MallocSizeOf;