diff --git a/client/capture_context_mac.h b/client/capture_context_mac.h index 7ec031f3..74e440ed 100644 --- a/client/capture_context_mac.h +++ b/client/capture_context_mac.h @@ -22,7 +22,7 @@ namespace crashpad { #if defined(ARCH_CPU_X86_FAMILY) -typedef x86_thread_state NativeCPUContext; +using NativeCPUContext = x86_thread_state; #endif //! \brief Saves the CPU context. diff --git a/client/simple_string_dictionary.cc b/client/simple_string_dictionary.cc index 171a8526..985b8938 100644 --- a/client/simple_string_dictionary.cc +++ b/client/simple_string_dictionary.cc @@ -23,7 +23,7 @@ namespace crashpad { namespace { -typedef TSimpleStringDictionary<1, 1, 1> SimpleStringDictionaryForAssertion; +using SimpleStringDictionaryForAssertion = TSimpleStringDictionary<1, 1, 1>; #if CXX_LIBRARY_VERSION >= 2011 // In C++11, check that TSimpleStringDictionary has standard layout, which is diff --git a/client/simple_string_dictionary.h b/client/simple_string_dictionary.h index 42fb29b7..4247da69 100644 --- a/client/simple_string_dictionary.h +++ b/client/simple_string_dictionary.h @@ -267,7 +267,7 @@ class TSimpleStringDictionary { //! //! For historical reasons this specialized version is available with the same //! size factors as a previous implementation. -typedef TSimpleStringDictionary<256, 256, 64> SimpleStringDictionary; +using SimpleStringDictionary = TSimpleStringDictionary<256, 256, 64>; } // namespace crashpad diff --git a/client/simple_string_dictionary_test.cc b/client/simple_string_dictionary_test.cc index 7cc298f9..173fee31 100644 --- a/client/simple_string_dictionary_test.cc +++ b/client/simple_string_dictionary_test.cc @@ -22,7 +22,7 @@ namespace test { namespace { TEST(SimpleStringDictionary, Entry) { - typedef TSimpleStringDictionary<5, 9, 15> TestMap; + using TestMap = TSimpleStringDictionary<5, 9, 15>; TestMap map; const TestMap::Entry* entry = TestMap::Iterator(map).Next(); @@ -238,7 +238,7 @@ TEST(SimpleStringDictionary, AddRemove) { } TEST(SimpleStringDictionary, Serialize) { - typedef TSimpleStringDictionary<4, 5, 7> TestMap; + using TestMap = TSimpleStringDictionary<4, 5, 7>; TestMap map; map.SetKeyValue("one", "abc"); map.SetKeyValue("two", "def"); diff --git a/client/simulate_crash_mac.cc b/client/simulate_crash_mac.cc index eb9b010e..b80355a4 100644 --- a/client/simulate_crash_mac.cc +++ b/client/simulate_crash_mac.cc @@ -71,7 +71,7 @@ bool DeliverException(thread_t thread, } // A const version of thread_state_t. - typedef const natural_t* ConstThreadState; + using ConstThreadState = const natural_t*; // old_state is only used if the context already captured doesn’t match (or // can’t be converted to) what’s registered for the handler. diff --git a/compat/mac/mach-o/getsect.cc b/compat/mac/mach-o/getsect.cc index b713180f..2990c925 100644 --- a/compat/mac/mach-o/getsect.cc +++ b/compat/mac/mach-o/getsect.cc @@ -58,15 +58,15 @@ void* LookUpSystemLibMachOSymbol(const char* symbol) { } #ifndef __LP64__ -typedef mach_header MachHeader; +using MachHeader = mach_header; #else -typedef mach_header_64 MachHeader; +using MachHeader = mach_header_64; #endif -typedef uint8_t*(*GetSectionDataType)( - const MachHeader*, const char*, const char*, unsigned long*); -typedef uint8_t*(*GetSegmentDataType)( - const MachHeader*, const char*, unsigned long*); +using GetSectionDataType = + uint8_t*(*)(const MachHeader*, const char*, const char*, unsigned long*); +using GetSegmentDataType = + uint8_t*(*)(const MachHeader*, const char*, unsigned long*); } // namespace diff --git a/compat/mac/mach-o/getsect.h b/compat/mac/mach-o/getsect.h index f982c4b4..c9169e16 100644 --- a/compat/mac/mach-o/getsect.h +++ b/compat/mac/mach-o/getsect.h @@ -32,11 +32,11 @@ extern "C" { #endif -// Don’t use a typedef to account for the mach_header/mach_header_64 difference -// between the 32-bit and 64-bit versions of getsectiondata() and +// Don’t use a type alias to account for the mach_header/mach_header_64 +// difference between the 32-bit and 64-bit versions of getsectiondata() and // getsegmentdata(). This file should be faithfully equivalent to the native -// SDK, and adding typedefs here would pollute the namespace in a way that the -// native SDK does not. +// SDK, and adding type aliases here would pollute the namespace in a way that +// the native SDK does not. #if !defined(__LP64__) diff --git a/minidump/minidump_string_writer.h b/minidump/minidump_string_writer.h index bde25b5c..1064736d 100644 --- a/minidump/minidump_string_writer.h +++ b/minidump/minidump_string_writer.h @@ -30,13 +30,13 @@ namespace internal { //! \cond struct MinidumpStringWriterUTF16Traits { - typedef string16 StringType; - typedef MINIDUMP_STRING MinidumpStringType; + using StringType = string16; + using MinidumpStringType = MINIDUMP_STRING; }; struct MinidumpStringWriterUTF8Traits { - typedef std::string StringType; - typedef MinidumpUTF8String MinidumpStringType; + using StringType = std::string; + using MinidumpStringType = MinidumpUTF8String; }; //! \endcond @@ -54,8 +54,8 @@ class MinidumpStringWriter : public MinidumpWritable { ~MinidumpStringWriter() override; protected: - typedef typename Traits::MinidumpStringType MinidumpStringType; - typedef typename Traits::StringType StringType; + using MinidumpStringType = typename Traits::MinidumpStringType; + using StringType = typename Traits::StringType; bool Freeze() override; size_t SizeOfObject() override; diff --git a/minidump/minidump_thread_writer_test.cc b/minidump/minidump_thread_writer_test.cc index a74307e9..8b629bb5 100644 --- a/minidump/minidump_thread_writer_test.cc +++ b/minidump/minidump_thread_writer_test.cc @@ -481,7 +481,7 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) { } struct InitializeFromSnapshotX86Traits { - typedef MinidumpContextX86 MinidumpContextType; + using MinidumpContextType = MinidumpContextX86; static void InitializeCPUContext(CPUContext* context, uint32_t seed) { return InitializeCPUContextX86(context, seed); } @@ -492,7 +492,7 @@ struct InitializeFromSnapshotX86Traits { }; struct InitializeFromSnapshotAMD64Traits { - typedef MinidumpContextAMD64 MinidumpContextType; + using MinidumpContextType = MinidumpContextAMD64; static void InitializeCPUContext(CPUContext* context, uint32_t seed) { return InitializeCPUContextX86_64(context, seed); } @@ -504,7 +504,7 @@ struct InitializeFromSnapshotAMD64Traits { }; struct InitializeFromSnapshotNoContextTraits { - typedef MinidumpContextX86 MinidumpContextType; + using MinidumpContextType = MinidumpContextX86; static void InitializeCPUContext(CPUContext* context, uint32_t seed) { context->architecture = kCPUArchitectureUnknown; } @@ -517,7 +517,7 @@ struct InitializeFromSnapshotNoContextTraits { template void RunInitializeFromSnapshotTest(bool thread_id_collision) { - typedef typename Traits::MinidumpContextType MinidumpContextType; + using MinidumpContextType = typename Traits::MinidumpContextType; MINIDUMP_THREAD expect_threads[3] = {}; uint64_t thread_ids[arraysize(expect_threads)] = {}; uint8_t memory_values[arraysize(expect_threads)] = {}; diff --git a/minidump/test/minidump_writable_test_util.cc b/minidump/test/minidump_writable_test_util.cc index ccee7ed1..f1389908 100644 --- a/minidump/test/minidump_writable_test_util.cc +++ b/minidump/test/minidump_writable_test_util.cc @@ -137,7 +137,7 @@ const MINIDUMP_HEADER* MinidumpWritableAtLocationDescriptor( namespace { struct MinidumpMemoryListTraits { - typedef MINIDUMP_MEMORY_LIST ListType; + using ListType = MINIDUMP_MEMORY_LIST; static constexpr size_t kElementSize = sizeof(MINIDUMP_MEMORY_DESCRIPTOR); static size_t ElementCount(const ListType* list) { return list->NumberOfMemoryRanges; @@ -145,7 +145,7 @@ struct MinidumpMemoryListTraits { }; struct MinidumpModuleListTraits { - typedef MINIDUMP_MODULE_LIST ListType; + using ListType = MINIDUMP_MODULE_LIST; static constexpr size_t kElementSize = sizeof(MINIDUMP_MODULE); static size_t ElementCount(const ListType* list) { return list->NumberOfModules; @@ -153,7 +153,7 @@ struct MinidumpModuleListTraits { }; struct MinidumpThreadListTraits { - typedef MINIDUMP_THREAD_LIST ListType; + using ListType = MINIDUMP_THREAD_LIST; static constexpr size_t kElementSize = sizeof(MINIDUMP_THREAD); static size_t ElementCount(const ListType* list) { return list->NumberOfThreads; @@ -161,7 +161,7 @@ struct MinidumpThreadListTraits { }; struct MinidumpModuleCrashpadInfoListTraits { - typedef MinidumpModuleCrashpadInfoList ListType; + using ListType = MinidumpModuleCrashpadInfoList; static constexpr size_t kElementSize = sizeof(MINIDUMP_LOCATION_DESCRIPTOR); static size_t ElementCount(const ListType* list) { return list->count; @@ -169,7 +169,7 @@ struct MinidumpModuleCrashpadInfoListTraits { }; struct MinidumpSimpleStringDictionaryListTraits { - typedef MinidumpSimpleStringDictionary ListType; + using ListType = MinidumpSimpleStringDictionary; static constexpr size_t kElementSize = sizeof(MinidumpSimpleStringDictionaryEntry); static size_t ElementCount(const ListType* list) { diff --git a/snapshot/cpu_context.h b/snapshot/cpu_context.h index 8b72c459..bfef4d09 100644 --- a/snapshot/cpu_context.h +++ b/snapshot/cpu_context.h @@ -23,7 +23,7 @@ namespace crashpad { //! \brief A context structure carrying 32-bit x86 CPU state. struct CPUContextX86 { - typedef uint8_t X87Register[10]; + using X87Register = uint8_t[10]; union X87OrMMXRegister { struct { @@ -36,7 +36,7 @@ struct CPUContextX86 { }; }; - typedef uint8_t XMMRegister[16]; + using XMMRegister = uint8_t[16]; struct Fxsave { uint16_t fcw; // FPU control word @@ -121,9 +121,9 @@ struct CPUContextX86 { //! \brief A context structure carrying x86_64 CPU state. struct CPUContextX86_64 { - typedef CPUContextX86::X87Register X87Register; - typedef CPUContextX86::X87OrMMXRegister X87OrMMXRegister; - typedef CPUContextX86::XMMRegister XMMRegister; + using X87Register = CPUContextX86::X87Register; + using X87OrMMXRegister = CPUContextX86::X87OrMMXRegister; + using XMMRegister = CPUContextX86::XMMRegister; struct Fxsave { uint16_t fcw; // FPU control word diff --git a/snapshot/mac/mach_o_image_reader_test.cc b/snapshot/mac/mach_o_image_reader_test.cc index 57dc28ed..3412aabd 100644 --- a/snapshot/mac/mach_o_image_reader_test.cc +++ b/snapshot/mac/mach_o_image_reader_test.cc @@ -43,22 +43,22 @@ namespace { // Native types and constants, in cases where the 32-bit and 64-bit versions // are different. #if defined(ARCH_CPU_64_BITS) -typedef mach_header_64 MachHeader; +using MachHeader = mach_header_64; const uint32_t kMachMagic = MH_MAGIC_64; -typedef segment_command_64 SegmentCommand; +using SegmentCommand = segment_command_64; const uint32_t kSegmentCommand = LC_SEGMENT_64; -typedef section_64 Section; -typedef nlist_64 Nlist; +using Section = section_64; +using Nlist = nlist_64; #else -typedef mach_header MachHeader; +using MachHeader = mach_header; const uint32_t kMachMagic = MH_MAGIC; -typedef segment_command SegmentCommand; +using SegmentCommand = segment_command; const uint32_t kSegmentCommand = LC_SEGMENT; -typedef section Section; +using Section = section; // This needs to be called “struct nlist” because “nlist” without the struct // refers to the nlist() function. -typedef struct nlist Nlist; +using Nlist = struct nlist; #endif #if defined(ARCH_CPU_X86_64) diff --git a/snapshot/mac/mach_o_image_symbol_table_reader.h b/snapshot/mac/mach_o_image_symbol_table_reader.h index 5970be5c..9302e7fc 100644 --- a/snapshot/mac/mach_o_image_symbol_table_reader.h +++ b/snapshot/mac/mach_o_image_symbol_table_reader.h @@ -66,7 +66,7 @@ class MachOImageSymbolTableReader { // // This is public so that the type is available to // MachOImageSymbolTableReaderInitializer. - typedef std::map SymbolInformationMap; + using SymbolInformationMap = std::map; MachOImageSymbolTableReader(); ~MachOImageSymbolTableReader(); diff --git a/snapshot/mac/process_reader_test.cc b/snapshot/mac/process_reader_test.cc index 5a556f20..7e8c65d3 100644 --- a/snapshot/mac/process_reader_test.cc +++ b/snapshot/mac/process_reader_test.cc @@ -289,7 +289,7 @@ class TestThreadPool { DISALLOW_COPY_AND_ASSIGN(TestThreadPool); }; -typedef std::map ThreadMap; +using ThreadMap = std::map; // Verifies that all of the threads in |threads|, obtained from ProcessReader, // agree with the expectation in |thread_map|. If |tolerate_extra_threads| is diff --git a/snapshot/mac/process_types.cc b/snapshot/mac/process_types.cc index 5bb0496a..8c907b2f 100644 --- a/snapshot/mac/process_types.cc +++ b/snapshot/mac/process_types.cc @@ -43,21 +43,21 @@ inline void Assign inline void Assign(CharArray16* destination, const CharArray16& source) { memcpy(destination, &source, sizeof(source)); } -typedef uint64_t UInt64Array16[16]; +using UInt64Array16 = uint64_t[16]; template <> inline void Assign(UInt64Array16* destination, const UInt64Array16& source) { memcpy(destination, &source, sizeof(source)); } -typedef uint32_t UInt32Array16[16]; +using UInt32Array16 = uint32_t[16]; template <> inline void Assign(UInt64Array16* destination, const UInt32Array16& source) { @@ -68,7 +68,7 @@ inline void Assign(UInt64Array16* destination, template <> inline void Assign(uuid_t* destination, const uuid_t& source) { - // uuid_t is a typedef for unsigned char[16]. + // uuid_t is a type alias for unsigned char[16]. memcpy(destination, &source, sizeof(source)); } diff --git a/snapshot/mac/process_types.h b/snapshot/mac/process_types.h index 4915169b..b38fea78 100644 --- a/snapshot/mac/process_types.h +++ b/snapshot/mac/process_types.h @@ -31,8 +31,8 @@ namespace internal { // additional “reserved” padding fields present only in the 64-bit environment. // These Reserved64Only* types allow the process_types system to replicate these // structures more precisely. -typedef char Reserved64Only32[0]; -typedef uint32_t Reserved64Only64; +using Reserved64Only32 = char[0]; +using Reserved64Only64 = uint32_t; } // namespace internal } // namespace process_types @@ -56,12 +56,12 @@ DECLARE_PROCESS_TYPE_TRAITS_CLASS(Generic, 64) namespace process_types { \ struct struct_name { \ public: \ - typedef internal::TraitsGeneric::Long Long; \ - typedef internal::TraitsGeneric::ULong ULong; \ - typedef internal::TraitsGeneric::Pointer Pointer; \ - typedef internal::TraitsGeneric::IntPtr IntPtr; \ - typedef internal::TraitsGeneric::UIntPtr UIntPtr; \ - typedef internal::TraitsGeneric::Reserved64Only Reserved64Only; \ + using Long = internal::TraitsGeneric::Long; \ + using ULong = internal::TraitsGeneric::ULong; \ + using Pointer = internal::TraitsGeneric::Pointer; \ + using IntPtr = internal::TraitsGeneric::IntPtr; \ + using UIntPtr = internal::TraitsGeneric::UIntPtr; \ + using Reserved64Only = internal::TraitsGeneric::Reserved64Only; \ \ /* Initializes an object with data read from |process_reader| at \ * |address|, properly genericized. */ \ @@ -136,12 +136,12 @@ DECLARE_PROCESS_TYPE_TRAITS_CLASS(Generic, 64) template \ struct struct_name { \ public: \ - typedef typename Traits::Long Long; \ - typedef typename Traits::ULong ULong; \ - typedef typename Traits::Pointer Pointer; \ - typedef typename Traits::IntPtr IntPtr; \ - typedef typename Traits::UIntPtr UIntPtr; \ - typedef typename Traits::Reserved64Only Reserved64Only; \ + using Long = typename Traits::Long; \ + using ULong = typename Traits::ULong; \ + using Pointer = typename Traits::Pointer; \ + using IntPtr = typename Traits::IntPtr; \ + using UIntPtr = typename Traits::UIntPtr; \ + using Reserved64Only = typename Traits::Reserved64Only; \ \ /* Read(), ReadArrayInto(), and Size() are as in the generic user-visible \ * struct above. */ \ diff --git a/snapshot/mac/process_types/traits.h b/snapshot/mac/process_types/traits.h index 6eac49ad..73ca7e95 100644 --- a/snapshot/mac/process_types/traits.h +++ b/snapshot/mac/process_types/traits.h @@ -24,18 +24,18 @@ // // |Reserved| is used for padding fields that may be zero-length, and thus // __VA_ARGS__, which is intended to set the alignment of the 64-bit types, is -// not used for that typedef. +// not used for that type alias. #define DECLARE_PROCESS_TYPE_TRAITS_CLASS(traits_name, lp_bits, ...) \ namespace crashpad { \ namespace process_types { \ namespace internal { \ struct Traits##traits_name { \ - typedef int##lp_bits##_t Long __VA_ARGS__; \ - typedef uint##lp_bits##_t ULong __VA_ARGS__; \ - typedef uint##lp_bits##_t Pointer __VA_ARGS__; \ - typedef int##lp_bits##_t IntPtr __VA_ARGS__; \ - typedef uint##lp_bits##_t UIntPtr __VA_ARGS__; \ - typedef Reserved64Only##lp_bits Reserved64Only; \ + using Long = int##lp_bits##_t __VA_ARGS__; \ + using ULong = uint##lp_bits##_t __VA_ARGS__; \ + using Pointer = uint##lp_bits##_t __VA_ARGS__; \ + using IntPtr = int##lp_bits##_t __VA_ARGS__; \ + using UIntPtr = uint##lp_bits##_t __VA_ARGS__; \ + using Reserved64Only = Reserved64Only##lp_bits; \ }; \ } \ } \ diff --git a/util/file/fd_io.cc b/util/file/fd_io.cc index 95257d83..270539c4 100644 --- a/util/file/fd_io.cc +++ b/util/file/fd_io.cc @@ -23,16 +23,16 @@ namespace { struct ReadTraits { - typedef void* VoidBufferType; - typedef char* CharBufferType; + using VoidBufferType = void*; + using CharBufferType = char*; static ssize_t Operate(int fd, CharBufferType buffer, size_t size) { return read(fd, buffer, size); } }; struct WriteTraits { - typedef const void* VoidBufferType; - typedef const char* CharBufferType; + using VoidBufferType = const void*; + using CharBufferType = const char*; static ssize_t Operate(int fd, CharBufferType buffer, size_t size) { return write(fd, buffer, size); } diff --git a/util/mach/exc_server_variants.cc b/util/mach/exc_server_variants.cc index 4c2fecee..1f6e6782 100644 --- a/util/mach/exc_server_variants.cc +++ b/util/mach/exc_server_variants.cc @@ -152,7 +152,7 @@ enum MachMessageID : mach_msg_id_t { kern_return_t MIGCheckRequestExceptionRaise( const __Request__exception_raise_t* in_request) { - typedef __Request__exception_raise_t Request; + using Request = __Request__exception_raise_t; return __MIG_check__Request__exception_raise_t( const_cast(in_request)); } @@ -160,7 +160,7 @@ kern_return_t MIGCheckRequestExceptionRaise( kern_return_t MIGCheckRequestExceptionRaiseState( const __Request__exception_raise_state_t* in_request, const __Request__exception_raise_state_t** in_request_1) { - typedef __Request__exception_raise_state_t Request; + using Request = __Request__exception_raise_state_t; return __MIG_check__Request__exception_raise_state_t( const_cast(in_request), const_cast(in_request_1)); } @@ -168,14 +168,14 @@ kern_return_t MIGCheckRequestExceptionRaiseState( kern_return_t MIGCheckRequestExceptionRaiseStateIdentity( const __Request__exception_raise_state_identity_t* in_request, const __Request__exception_raise_state_identity_t** in_request_1) { - typedef __Request__exception_raise_state_identity_t Request; + using Request = __Request__exception_raise_state_identity_t; return __MIG_check__Request__exception_raise_state_identity_t( const_cast(in_request), const_cast(in_request_1)); } kern_return_t MIGCheckRequestMachExceptionRaise( const __Request__mach_exception_raise_t* in_request) { - typedef __Request__mach_exception_raise_t Request; + using Request = __Request__mach_exception_raise_t; return __MIG_check__Request__mach_exception_raise_t( const_cast(in_request)); } @@ -183,7 +183,7 @@ kern_return_t MIGCheckRequestMachExceptionRaise( kern_return_t MIGCheckRequestMachExceptionRaiseState( const __Request__mach_exception_raise_state_t* in_request, const __Request__mach_exception_raise_state_t** in_request_1) { - typedef __Request__mach_exception_raise_state_t Request; + using Request = __Request__mach_exception_raise_state_t; return __MIG_check__Request__mach_exception_raise_state_t( const_cast(in_request), const_cast(in_request_1)); } @@ -191,7 +191,7 @@ kern_return_t MIGCheckRequestMachExceptionRaiseState( kern_return_t MIGCheckRequestMachExceptionRaiseStateIdentity( const __Request__mach_exception_raise_state_identity_t* in_request, const __Request__mach_exception_raise_state_identity_t** in_request_1) { - typedef __Request__mach_exception_raise_state_identity_t Request; + using Request = __Request__mach_exception_raise_state_identity_t; return __MIG_check__Request__mach_exception_raise_state_identity_t( const_cast(in_request), const_cast(in_request_1)); } @@ -214,7 +214,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, switch (in_header->msgh_id) { case kMachMessageIDExceptionRaise: { // exception_raise(), catch_exception_raise(). - typedef __Request__exception_raise_t Request; + using Request = __Request__exception_raise_t; const Request* in_request = reinterpret_cast(in_header); kern_return_t kr = MIGCheckRequestExceptionRaise(in_request); if (kr != MACH_MSG_SUCCESS) { @@ -222,7 +222,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, return true; } - typedef __Reply__exception_raise_t Reply; + using Reply = __Reply__exception_raise_t; Reply* out_reply = reinterpret_cast(out_header); out_reply->RetCode = interface_->CatchExceptionRaise(in_header->msgh_local_port, @@ -242,7 +242,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, case kMachMessageIDExceptionRaiseState: { // exception_raise_state(), catch_exception_raise_state(). - typedef __Request__exception_raise_state_t Request; + using Request = __Request__exception_raise_state_t; const Request* in_request = reinterpret_cast(in_header); // in_request_1 is used for the portion of the request after the codes, @@ -255,7 +255,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, return true; } - typedef __Reply__exception_raise_state_t Reply; + using Reply = __Reply__exception_raise_state_t; Reply* out_reply = reinterpret_cast(out_header); out_reply->flavor = in_request_1->flavor; out_reply->new_stateCnt = arraysize(out_reply->new_state); @@ -282,7 +282,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, case kMachMessageIDExceptionRaiseStateIdentity: { // exception_raise_state_identity(), // catch_exception_raise_state_identity(). - typedef __Request__exception_raise_state_identity_t Request; + using Request = __Request__exception_raise_state_identity_t; const Request* in_request = reinterpret_cast(in_header); // in_request_1 is used for the portion of the request after the codes, @@ -295,7 +295,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, return true; } - typedef __Reply__exception_raise_state_identity_t Reply; + using Reply = __Reply__exception_raise_state_identity_t; Reply* out_reply = reinterpret_cast(out_header); out_reply->flavor = in_request_1->flavor; out_reply->new_stateCnt = arraysize(out_reply->new_state); @@ -349,7 +349,7 @@ bool MachExcServer::MachMessageServerFunction( switch (in_header->msgh_id) { case kMachMessageIDMachExceptionRaise: { // mach_exception_raise(), catch_mach_exception_raise(). - typedef __Request__mach_exception_raise_t Request; + using Request = __Request__mach_exception_raise_t; const Request* in_request = reinterpret_cast(in_header); kern_return_t kr = MIGCheckRequestMachExceptionRaise(in_request); if (kr != MACH_MSG_SUCCESS) { @@ -357,7 +357,7 @@ bool MachExcServer::MachMessageServerFunction( return true; } - typedef __Reply__mach_exception_raise_t Reply; + using Reply = __Reply__mach_exception_raise_t; Reply* out_reply = reinterpret_cast(out_header); out_reply->RetCode = interface_->CatchMachExceptionRaise(in_header->msgh_local_port, @@ -377,7 +377,7 @@ bool MachExcServer::MachMessageServerFunction( case kMachMessageIDMachExceptionRaiseState: { // mach_exception_raise_state(), catch_mach_exception_raise_state(). - typedef __Request__mach_exception_raise_state_t Request; + using Request = __Request__mach_exception_raise_state_t; const Request* in_request = reinterpret_cast(in_header); // in_request_1 is used for the portion of the request after the codes, @@ -390,7 +390,7 @@ bool MachExcServer::MachMessageServerFunction( return true; } - typedef __Reply__mach_exception_raise_state_t Reply; + using Reply = __Reply__mach_exception_raise_state_t; Reply* out_reply = reinterpret_cast(out_header); out_reply->flavor = in_request_1->flavor; out_reply->new_stateCnt = arraysize(out_reply->new_state); @@ -417,7 +417,7 @@ bool MachExcServer::MachMessageServerFunction( case kMachMessageIDMachExceptionRaiseStateIdentity: { // mach_exception_raise_state_identity(), // catch_mach_exception_raise_state_identity(). - typedef __Request__mach_exception_raise_state_identity_t Request; + using Request = __Request__mach_exception_raise_state_identity_t; const Request* in_request = reinterpret_cast(in_header); // in_request_1 is used for the portion of the request after the codes, @@ -430,7 +430,7 @@ bool MachExcServer::MachMessageServerFunction( return true; } - typedef __Reply__mach_exception_raise_state_identity_t Reply; + using Reply = __Reply__mach_exception_raise_state_identity_t; Reply* out_reply = reinterpret_cast(out_header); out_reply->flavor = in_request_1->flavor; out_reply->new_stateCnt = arraysize(out_reply->new_state); diff --git a/util/mach/exc_server_variants_test.cc b/util/mach/exc_server_variants_test.cc index 598c3bca..57a55f7e 100644 --- a/util/mach/exc_server_variants_test.cc +++ b/util/mach/exc_server_variants_test.cc @@ -268,7 +268,7 @@ struct __attribute__((packed, aligned(4))) ExceptionRaiseStateIdentityRequest { // The reply messages for exception_raise_state and // exception_raise_state_identity are identical. -typedef ExceptionRaiseStateReply ExceptionRaiseStateIdentityReply; +using ExceptionRaiseStateIdentityReply = ExceptionRaiseStateReply; struct __attribute__((packed, aligned(4))) MachExceptionRaiseRequest { mach_msg_header_t Head; @@ -302,7 +302,7 @@ struct __attribute__((packed, aligned(4))) MachExceptionRaiseRequest { // The reply messages for exception_raise and mach_exception_raise are // identical. -typedef ExceptionRaiseReply MachExceptionRaiseReply; +using MachExceptionRaiseReply = ExceptionRaiseReply; struct __attribute__((packed, aligned(4))) MachExceptionRaiseStateRequest { mach_msg_header_t Head; @@ -338,7 +338,7 @@ struct __attribute__((packed, aligned(4))) MachExceptionRaiseStateRequest { // The reply messages for exception_raise_state and mach_exception_raise_state // are identical. -typedef ExceptionRaiseStateReply MachExceptionRaiseStateReply; +using MachExceptionRaiseStateReply = ExceptionRaiseStateReply; struct __attribute__((packed, aligned(4))) MachExceptionRaiseStateIdentityRequest { @@ -382,7 +382,7 @@ struct __attribute__((packed, // The reply messages for exception_raise_state_identity and // mach_exception_raise_state_identity are identical. -typedef ExceptionRaiseStateIdentityReply MachExceptionRaiseStateIdentityReply; +using MachExceptionRaiseStateIdentityReply = ExceptionRaiseStateIdentityReply; // InvalidRequest and BadIDErrorReply are used to test that // UniversalMachExcServer deals appropriately with messages that it does not diff --git a/util/mach/exception_ports.h b/util/mach/exception_ports.h index 2c4983d7..d82ac2dc 100644 --- a/util/mach/exception_ports.h +++ b/util/mach/exception_ports.h @@ -153,7 +153,7 @@ class ExceptionPorts { const char* TargetTypeName() const; private: - typedef kern_return_t (*GetExceptionPortsType)(mach_port_t, + using GetExceptionPortsType = kern_return_t(*)(mach_port_t, exception_mask_t, exception_mask_array_t, mach_msg_type_number_t*, @@ -161,7 +161,7 @@ class ExceptionPorts { exception_behavior_array_t, exception_flavor_array_t); - typedef kern_return_t (*SetExceptionPortsType)(mach_port_t, + using SetExceptionPortsType = kern_return_t(*)(mach_port_t, exception_mask_t, exception_handler_t, exception_behavior_t, diff --git a/util/mach/symbolic_constants_mach_test.cc b/util/mach/symbolic_constants_mach_test.cc index ff7d71db..3ac09f24 100644 --- a/util/mach/symbolic_constants_mach_test.cc +++ b/util/mach/symbolic_constants_mach_test.cc @@ -134,7 +134,7 @@ const struct { }; struct ConvertExceptionTraits { - typedef exception_type_t ValueType; + using ValueType = exception_type_t; static std::string SomethingToString( ValueType value, SymbolicConstantToStringOptions options) { @@ -309,7 +309,7 @@ const struct { }; struct ConvertExceptionMaskTraits { - typedef exception_mask_t ValueType; + using ValueType = exception_mask_t; static std::string SomethingToString( ValueType value, SymbolicConstantToStringOptions options) { @@ -552,7 +552,7 @@ const struct { }; struct ConvertExceptionBehaviorTraits { - typedef exception_behavior_t ValueType; + using ValueType = exception_behavior_t; static std::string SomethingToString( ValueType value, SymbolicConstantToStringOptions options) { @@ -815,7 +815,7 @@ const struct { }; struct ConvertThreadStateFlavorTraits { - typedef thread_state_flavor_t ValueType; + using ValueType = thread_state_flavor_t; static std::string SomethingToString( ValueType value, SymbolicConstantToStringOptions options) { diff --git a/util/misc/initialization_state_dcheck.h b/util/misc/initialization_state_dcheck.h index d40aab5f..88f7ac1e 100644 --- a/util/misc/initialization_state_dcheck.h +++ b/util/misc/initialization_state_dcheck.h @@ -162,7 +162,7 @@ class InitializationStateDcheck : public InitializationState { // without complaint even with warnings turned up. They take up no space at all, // and they can be “initialized” with the same () syntax used to initialize // objects of the DCHECK_IS_ON InitializationStateDcheck class above. -typedef bool InitializationStateDcheck[0]; +using InitializationStateDcheck = bool[0]; namespace internal { diff --git a/util/misc/symbolic_constants_common.h b/util/misc/symbolic_constants_common.h index fe4a3ba8..ea2495aa 100644 --- a/util/misc/symbolic_constants_common.h +++ b/util/misc/symbolic_constants_common.h @@ -92,7 +92,7 @@ enum SymbolicConstantToStringOptionBits { }; //! \brief A bitfield containing values of #SymbolicConstantToStringOptionBits. -typedef unsigned int SymbolicConstantToStringOptions; +using SymbolicConstantToStringOptions = unsigned int; //! \brief Options for various `StringTo*` functions in `symbolic_constants_*` //! files. @@ -125,7 +125,7 @@ enum StringToSymbolicConstantOptionBits { }; //! \brief A bitfield containing values of #StringToSymbolicConstantOptionBits. -typedef unsigned int StringToSymbolicConstantOptions; +using StringToSymbolicConstantOptions = unsigned int; } // namespace crashpad diff --git a/util/stdlib/string_number_conversion.cc b/util/stdlib/string_number_conversion.cc index 0c16c038..a7c7d519 100644 --- a/util/stdlib/string_number_conversion.cc +++ b/util/stdlib/string_number_conversion.cc @@ -40,8 +40,8 @@ namespace { template struct StringToIntegerTraits { - typedef TIntType IntType; - typedef TLongType LongType; + using IntType = TIntType; + using LongType = TLongType; static void TypeCheck() { static_assert(std::numeric_limits::is_integer && std::numeric_limits::is_integer, @@ -75,7 +75,7 @@ struct StringToSignedIntegerTraits } private: - typedef StringToIntegerTraits super; + using super = StringToIntegerTraits; }; template @@ -89,7 +89,7 @@ struct StringToUnsignedIntegerTraits static bool IsNegativeOverflow(TLongType value) { return false; } private: - typedef StringToIntegerTraits super; + using super = StringToIntegerTraits; }; struct StringToIntTraits : public StringToSignedIntegerTraits { @@ -111,8 +111,8 @@ struct StringToUnsignedIntTraits template bool StringToIntegerInternal(const base::StringPiece& string, typename Traits::IntType* number) { - typedef typename Traits::IntType IntType; - typedef typename Traits::LongType LongType; + using IntType = typename Traits::IntType; + using LongType = typename Traits::LongType; Traits::TypeCheck(); diff --git a/util/test/posix/close_multiple.cc b/util/test/posix/close_multiple.cc index e2020a90..0b5cd995 100644 --- a/util/test/posix/close_multiple.cc +++ b/util/test/posix/close_multiple.cc @@ -72,7 +72,7 @@ struct ScopedDIRCloser { } }; -typedef scoped_ptr ScopedDIR; +using ScopedDIR = scoped_ptr; // This function implements CloseMultipleNowOrOnExec() using an operating // system-specific FD directory to determine which file descriptors are open.