C++11: Use type aliases instead of typedefs.

This replaces all occurrences of “typedef Y X;” with “using X = Y;”.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/700143004
This commit is contained in:
Mark Mentovai 2014-11-05 14:09:01 -05:00
parent 62b0976290
commit de0979b930
26 changed files with 113 additions and 113 deletions

View File

@ -22,7 +22,7 @@
namespace crashpad { namespace crashpad {
#if defined(ARCH_CPU_X86_FAMILY) #if defined(ARCH_CPU_X86_FAMILY)
typedef x86_thread_state NativeCPUContext; using NativeCPUContext = x86_thread_state;
#endif #endif
//! \brief Saves the CPU context. //! \brief Saves the CPU context.

View File

@ -23,7 +23,7 @@
namespace crashpad { namespace crashpad {
namespace { namespace {
typedef TSimpleStringDictionary<1, 1, 1> SimpleStringDictionaryForAssertion; using SimpleStringDictionaryForAssertion = TSimpleStringDictionary<1, 1, 1>;
#if CXX_LIBRARY_VERSION >= 2011 #if CXX_LIBRARY_VERSION >= 2011
// In C++11, check that TSimpleStringDictionary has standard layout, which is // In C++11, check that TSimpleStringDictionary has standard layout, which is

View File

@ -267,7 +267,7 @@ class TSimpleStringDictionary {
//! //!
//! For historical reasons this specialized version is available with the same //! For historical reasons this specialized version is available with the same
//! size factors as a previous implementation. //! size factors as a previous implementation.
typedef TSimpleStringDictionary<256, 256, 64> SimpleStringDictionary; using SimpleStringDictionary = TSimpleStringDictionary<256, 256, 64>;
} // namespace crashpad } // namespace crashpad

View File

@ -22,7 +22,7 @@ namespace test {
namespace { namespace {
TEST(SimpleStringDictionary, Entry) { TEST(SimpleStringDictionary, Entry) {
typedef TSimpleStringDictionary<5, 9, 15> TestMap; using TestMap = TSimpleStringDictionary<5, 9, 15>;
TestMap map; TestMap map;
const TestMap::Entry* entry = TestMap::Iterator(map).Next(); const TestMap::Entry* entry = TestMap::Iterator(map).Next();
@ -238,7 +238,7 @@ TEST(SimpleStringDictionary, AddRemove) {
} }
TEST(SimpleStringDictionary, Serialize) { TEST(SimpleStringDictionary, Serialize) {
typedef TSimpleStringDictionary<4, 5, 7> TestMap; using TestMap = TSimpleStringDictionary<4, 5, 7>;
TestMap map; TestMap map;
map.SetKeyValue("one", "abc"); map.SetKeyValue("one", "abc");
map.SetKeyValue("two", "def"); map.SetKeyValue("two", "def");

View File

@ -71,7 +71,7 @@ bool DeliverException(thread_t thread,
} }
// A const version of thread_state_t. // 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 doesnt match (or // old_state is only used if the context already captured doesnt match (or
// cant be converted to) whats registered for the handler. // cant be converted to) whats registered for the handler.

View File

@ -58,15 +58,15 @@ void* LookUpSystemLibMachOSymbol(const char* symbol) {
} }
#ifndef __LP64__ #ifndef __LP64__
typedef mach_header MachHeader; using MachHeader = mach_header;
#else #else
typedef mach_header_64 MachHeader; using MachHeader = mach_header_64;
#endif #endif
typedef uint8_t*(*GetSectionDataType)( using GetSectionDataType =
const MachHeader*, const char*, const char*, unsigned long*); uint8_t*(*)(const MachHeader*, const char*, const char*, unsigned long*);
typedef uint8_t*(*GetSegmentDataType)( using GetSegmentDataType =
const MachHeader*, const char*, unsigned long*); uint8_t*(*)(const MachHeader*, const char*, unsigned long*);
} // namespace } // namespace

View File

@ -32,11 +32,11 @@
extern "C" { extern "C" {
#endif #endif
// Dont use a typedef to account for the mach_header/mach_header_64 difference // Dont use a type alias to account for the mach_header/mach_header_64
// between the 32-bit and 64-bit versions of getsectiondata() and // difference between the 32-bit and 64-bit versions of getsectiondata() and
// getsegmentdata(). This file should be faithfully equivalent to the native // getsegmentdata(). This file should be faithfully equivalent to the native
// SDK, and adding typedefs here would pollute the namespace in a way that the // SDK, and adding type aliases here would pollute the namespace in a way that
// native SDK does not. // the native SDK does not.
#if !defined(__LP64__) #if !defined(__LP64__)

View File

@ -30,13 +30,13 @@ namespace internal {
//! \cond //! \cond
struct MinidumpStringWriterUTF16Traits { struct MinidumpStringWriterUTF16Traits {
typedef string16 StringType; using StringType = string16;
typedef MINIDUMP_STRING MinidumpStringType; using MinidumpStringType = MINIDUMP_STRING;
}; };
struct MinidumpStringWriterUTF8Traits { struct MinidumpStringWriterUTF8Traits {
typedef std::string StringType; using StringType = std::string;
typedef MinidumpUTF8String MinidumpStringType; using MinidumpStringType = MinidumpUTF8String;
}; };
//! \endcond //! \endcond
@ -54,8 +54,8 @@ class MinidumpStringWriter : public MinidumpWritable {
~MinidumpStringWriter() override; ~MinidumpStringWriter() override;
protected: protected:
typedef typename Traits::MinidumpStringType MinidumpStringType; using MinidumpStringType = typename Traits::MinidumpStringType;
typedef typename Traits::StringType StringType; using StringType = typename Traits::StringType;
bool Freeze() override; bool Freeze() override;
size_t SizeOfObject() override; size_t SizeOfObject() override;

View File

@ -481,7 +481,7 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
} }
struct InitializeFromSnapshotX86Traits { struct InitializeFromSnapshotX86Traits {
typedef MinidumpContextX86 MinidumpContextType; using MinidumpContextType = MinidumpContextX86;
static void InitializeCPUContext(CPUContext* context, uint32_t seed) { static void InitializeCPUContext(CPUContext* context, uint32_t seed) {
return InitializeCPUContextX86(context, seed); return InitializeCPUContextX86(context, seed);
} }
@ -492,7 +492,7 @@ struct InitializeFromSnapshotX86Traits {
}; };
struct InitializeFromSnapshotAMD64Traits { struct InitializeFromSnapshotAMD64Traits {
typedef MinidumpContextAMD64 MinidumpContextType; using MinidumpContextType = MinidumpContextAMD64;
static void InitializeCPUContext(CPUContext* context, uint32_t seed) { static void InitializeCPUContext(CPUContext* context, uint32_t seed) {
return InitializeCPUContextX86_64(context, seed); return InitializeCPUContextX86_64(context, seed);
} }
@ -504,7 +504,7 @@ struct InitializeFromSnapshotAMD64Traits {
}; };
struct InitializeFromSnapshotNoContextTraits { struct InitializeFromSnapshotNoContextTraits {
typedef MinidumpContextX86 MinidumpContextType; using MinidumpContextType = MinidumpContextX86;
static void InitializeCPUContext(CPUContext* context, uint32_t seed) { static void InitializeCPUContext(CPUContext* context, uint32_t seed) {
context->architecture = kCPUArchitectureUnknown; context->architecture = kCPUArchitectureUnknown;
} }
@ -517,7 +517,7 @@ struct InitializeFromSnapshotNoContextTraits {
template <typename Traits> template <typename Traits>
void RunInitializeFromSnapshotTest(bool thread_id_collision) { void RunInitializeFromSnapshotTest(bool thread_id_collision) {
typedef typename Traits::MinidumpContextType MinidumpContextType; using MinidumpContextType = typename Traits::MinidumpContextType;
MINIDUMP_THREAD expect_threads[3] = {}; MINIDUMP_THREAD expect_threads[3] = {};
uint64_t thread_ids[arraysize(expect_threads)] = {}; uint64_t thread_ids[arraysize(expect_threads)] = {};
uint8_t memory_values[arraysize(expect_threads)] = {}; uint8_t memory_values[arraysize(expect_threads)] = {};

View File

@ -137,7 +137,7 @@ const MINIDUMP_HEADER* MinidumpWritableAtLocationDescriptor<MINIDUMP_HEADER>(
namespace { namespace {
struct MinidumpMemoryListTraits { struct MinidumpMemoryListTraits {
typedef MINIDUMP_MEMORY_LIST ListType; using ListType = MINIDUMP_MEMORY_LIST;
static constexpr size_t kElementSize = sizeof(MINIDUMP_MEMORY_DESCRIPTOR); static constexpr size_t kElementSize = sizeof(MINIDUMP_MEMORY_DESCRIPTOR);
static size_t ElementCount(const ListType* list) { static size_t ElementCount(const ListType* list) {
return list->NumberOfMemoryRanges; return list->NumberOfMemoryRanges;
@ -145,7 +145,7 @@ struct MinidumpMemoryListTraits {
}; };
struct MinidumpModuleListTraits { struct MinidumpModuleListTraits {
typedef MINIDUMP_MODULE_LIST ListType; using ListType = MINIDUMP_MODULE_LIST;
static constexpr size_t kElementSize = sizeof(MINIDUMP_MODULE); static constexpr size_t kElementSize = sizeof(MINIDUMP_MODULE);
static size_t ElementCount(const ListType* list) { static size_t ElementCount(const ListType* list) {
return list->NumberOfModules; return list->NumberOfModules;
@ -153,7 +153,7 @@ struct MinidumpModuleListTraits {
}; };
struct MinidumpThreadListTraits { struct MinidumpThreadListTraits {
typedef MINIDUMP_THREAD_LIST ListType; using ListType = MINIDUMP_THREAD_LIST;
static constexpr size_t kElementSize = sizeof(MINIDUMP_THREAD); static constexpr size_t kElementSize = sizeof(MINIDUMP_THREAD);
static size_t ElementCount(const ListType* list) { static size_t ElementCount(const ListType* list) {
return list->NumberOfThreads; return list->NumberOfThreads;
@ -161,7 +161,7 @@ struct MinidumpThreadListTraits {
}; };
struct MinidumpModuleCrashpadInfoListTraits { struct MinidumpModuleCrashpadInfoListTraits {
typedef MinidumpModuleCrashpadInfoList ListType; using ListType = MinidumpModuleCrashpadInfoList;
static constexpr size_t kElementSize = sizeof(MINIDUMP_LOCATION_DESCRIPTOR); static constexpr size_t kElementSize = sizeof(MINIDUMP_LOCATION_DESCRIPTOR);
static size_t ElementCount(const ListType* list) { static size_t ElementCount(const ListType* list) {
return list->count; return list->count;
@ -169,7 +169,7 @@ struct MinidumpModuleCrashpadInfoListTraits {
}; };
struct MinidumpSimpleStringDictionaryListTraits { struct MinidumpSimpleStringDictionaryListTraits {
typedef MinidumpSimpleStringDictionary ListType; using ListType = MinidumpSimpleStringDictionary;
static constexpr size_t kElementSize = static constexpr size_t kElementSize =
sizeof(MinidumpSimpleStringDictionaryEntry); sizeof(MinidumpSimpleStringDictionaryEntry);
static size_t ElementCount(const ListType* list) { static size_t ElementCount(const ListType* list) {

View File

@ -23,7 +23,7 @@ namespace crashpad {
//! \brief A context structure carrying 32-bit x86 CPU state. //! \brief A context structure carrying 32-bit x86 CPU state.
struct CPUContextX86 { struct CPUContextX86 {
typedef uint8_t X87Register[10]; using X87Register = uint8_t[10];
union X87OrMMXRegister { union X87OrMMXRegister {
struct { struct {
@ -36,7 +36,7 @@ struct CPUContextX86 {
}; };
}; };
typedef uint8_t XMMRegister[16]; using XMMRegister = uint8_t[16];
struct Fxsave { struct Fxsave {
uint16_t fcw; // FPU control word uint16_t fcw; // FPU control word
@ -121,9 +121,9 @@ struct CPUContextX86 {
//! \brief A context structure carrying x86_64 CPU state. //! \brief A context structure carrying x86_64 CPU state.
struct CPUContextX86_64 { struct CPUContextX86_64 {
typedef CPUContextX86::X87Register X87Register; using X87Register = CPUContextX86::X87Register;
typedef CPUContextX86::X87OrMMXRegister X87OrMMXRegister; using X87OrMMXRegister = CPUContextX86::X87OrMMXRegister;
typedef CPUContextX86::XMMRegister XMMRegister; using XMMRegister = CPUContextX86::XMMRegister;
struct Fxsave { struct Fxsave {
uint16_t fcw; // FPU control word uint16_t fcw; // FPU control word

View File

@ -43,22 +43,22 @@ namespace {
// Native types and constants, in cases where the 32-bit and 64-bit versions // Native types and constants, in cases where the 32-bit and 64-bit versions
// are different. // are different.
#if defined(ARCH_CPU_64_BITS) #if defined(ARCH_CPU_64_BITS)
typedef mach_header_64 MachHeader; using MachHeader = mach_header_64;
const uint32_t kMachMagic = MH_MAGIC_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; const uint32_t kSegmentCommand = LC_SEGMENT_64;
typedef section_64 Section; using Section = section_64;
typedef nlist_64 Nlist; using Nlist = nlist_64;
#else #else
typedef mach_header MachHeader; using MachHeader = mach_header;
const uint32_t kMachMagic = MH_MAGIC; const uint32_t kMachMagic = MH_MAGIC;
typedef segment_command SegmentCommand; using SegmentCommand = segment_command;
const uint32_t kSegmentCommand = LC_SEGMENT; const uint32_t kSegmentCommand = LC_SEGMENT;
typedef section Section; using Section = section;
// This needs to be called “struct nlist” because “nlist” without the struct // This needs to be called “struct nlist” because “nlist” without the struct
// refers to the nlist() function. // refers to the nlist() function.
typedef struct nlist Nlist; using Nlist = struct nlist;
#endif #endif
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)

View File

@ -66,7 +66,7 @@ class MachOImageSymbolTableReader {
// //
// This is public so that the type is available to // This is public so that the type is available to
// MachOImageSymbolTableReaderInitializer. // MachOImageSymbolTableReaderInitializer.
typedef std::map<std::string, SymbolInformation> SymbolInformationMap; using SymbolInformationMap = std::map<std::string, SymbolInformation>;
MachOImageSymbolTableReader(); MachOImageSymbolTableReader();
~MachOImageSymbolTableReader(); ~MachOImageSymbolTableReader();

View File

@ -289,7 +289,7 @@ class TestThreadPool {
DISALLOW_COPY_AND_ASSIGN(TestThreadPool); DISALLOW_COPY_AND_ASSIGN(TestThreadPool);
}; };
typedef std::map<uint64_t, TestThreadPool::ThreadExpectation> ThreadMap; using ThreadMap = std::map<uint64_t, TestThreadPool::ThreadExpectation>;
// Verifies that all of the threads in |threads|, obtained from ProcessReader, // Verifies that all of the threads in |threads|, obtained from ProcessReader,
// agree with the expectation in |thread_map|. If |tolerate_extra_threads| is // agree with the expectation in |thread_map|. If |tolerate_extra_threads| is

View File

@ -43,21 +43,21 @@ inline void Assign<process_types::internal::Reserved64Only64,
*destination = 0; *destination = 0;
} }
typedef char CharArray16[16]; using CharArray16 = char[16];
template <> template <>
inline void Assign<CharArray16, CharArray16>(CharArray16* destination, inline void Assign<CharArray16, CharArray16>(CharArray16* destination,
const CharArray16& source) { const CharArray16& source) {
memcpy(destination, &source, sizeof(source)); memcpy(destination, &source, sizeof(source));
} }
typedef uint64_t UInt64Array16[16]; using UInt64Array16 = uint64_t[16];
template <> template <>
inline void Assign<UInt64Array16, UInt64Array16>(UInt64Array16* destination, inline void Assign<UInt64Array16, UInt64Array16>(UInt64Array16* destination,
const UInt64Array16& source) { const UInt64Array16& source) {
memcpy(destination, &source, sizeof(source)); memcpy(destination, &source, sizeof(source));
} }
typedef uint32_t UInt32Array16[16]; using UInt32Array16 = uint32_t[16];
template <> template <>
inline void Assign<UInt64Array16, UInt32Array16>(UInt64Array16* destination, inline void Assign<UInt64Array16, UInt32Array16>(UInt64Array16* destination,
const UInt32Array16& source) { const UInt32Array16& source) {
@ -68,7 +68,7 @@ inline void Assign<UInt64Array16, UInt32Array16>(UInt64Array16* destination,
template <> template <>
inline void Assign<uuid_t, uuid_t>(uuid_t* destination, const uuid_t& source) { inline void Assign<uuid_t, uuid_t>(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)); memcpy(destination, &source, sizeof(source));
} }

View File

@ -31,8 +31,8 @@ namespace internal {
// additional “reserved” padding fields present only in the 64-bit environment. // additional “reserved” padding fields present only in the 64-bit environment.
// These Reserved64Only* types allow the process_types system to replicate these // These Reserved64Only* types allow the process_types system to replicate these
// structures more precisely. // structures more precisely.
typedef char Reserved64Only32[0]; using Reserved64Only32 = char[0];
typedef uint32_t Reserved64Only64; using Reserved64Only64 = uint32_t;
} // namespace internal } // namespace internal
} // namespace process_types } // namespace process_types
@ -56,12 +56,12 @@ DECLARE_PROCESS_TYPE_TRAITS_CLASS(Generic, 64)
namespace process_types { \ namespace process_types { \
struct struct_name { \ struct struct_name { \
public: \ public: \
typedef internal::TraitsGeneric::Long Long; \ using Long = internal::TraitsGeneric::Long; \
typedef internal::TraitsGeneric::ULong ULong; \ using ULong = internal::TraitsGeneric::ULong; \
typedef internal::TraitsGeneric::Pointer Pointer; \ using Pointer = internal::TraitsGeneric::Pointer; \
typedef internal::TraitsGeneric::IntPtr IntPtr; \ using IntPtr = internal::TraitsGeneric::IntPtr; \
typedef internal::TraitsGeneric::UIntPtr UIntPtr; \ using UIntPtr = internal::TraitsGeneric::UIntPtr; \
typedef internal::TraitsGeneric::Reserved64Only Reserved64Only; \ using Reserved64Only = internal::TraitsGeneric::Reserved64Only; \
\ \
/* Initializes an object with data read from |process_reader| at \ /* Initializes an object with data read from |process_reader| at \
* |address|, properly genericized. */ \ * |address|, properly genericized. */ \
@ -136,12 +136,12 @@ DECLARE_PROCESS_TYPE_TRAITS_CLASS(Generic, 64)
template <typename Traits> \ template <typename Traits> \
struct struct_name { \ struct struct_name { \
public: \ public: \
typedef typename Traits::Long Long; \ using Long = typename Traits::Long; \
typedef typename Traits::ULong ULong; \ using ULong = typename Traits::ULong; \
typedef typename Traits::Pointer Pointer; \ using Pointer = typename Traits::Pointer; \
typedef typename Traits::IntPtr IntPtr; \ using IntPtr = typename Traits::IntPtr; \
typedef typename Traits::UIntPtr UIntPtr; \ using UIntPtr = typename Traits::UIntPtr; \
typedef typename Traits::Reserved64Only Reserved64Only; \ using Reserved64Only = typename Traits::Reserved64Only; \
\ \
/* Read(), ReadArrayInto(), and Size() are as in the generic user-visible \ /* Read(), ReadArrayInto(), and Size() are as in the generic user-visible \
* struct above. */ \ * struct above. */ \

View File

@ -24,18 +24,18 @@
// //
// |Reserved| is used for padding fields that may be zero-length, and thus // |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 // __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, ...) \ #define DECLARE_PROCESS_TYPE_TRAITS_CLASS(traits_name, lp_bits, ...) \
namespace crashpad { \ namespace crashpad { \
namespace process_types { \ namespace process_types { \
namespace internal { \ namespace internal { \
struct Traits##traits_name { \ struct Traits##traits_name { \
typedef int##lp_bits##_t Long __VA_ARGS__; \ using Long = int##lp_bits##_t __VA_ARGS__; \
typedef uint##lp_bits##_t ULong __VA_ARGS__; \ using ULong = uint##lp_bits##_t __VA_ARGS__; \
typedef uint##lp_bits##_t Pointer __VA_ARGS__; \ using Pointer = uint##lp_bits##_t __VA_ARGS__; \
typedef int##lp_bits##_t IntPtr __VA_ARGS__; \ using IntPtr = int##lp_bits##_t __VA_ARGS__; \
typedef uint##lp_bits##_t UIntPtr __VA_ARGS__; \ using UIntPtr = uint##lp_bits##_t __VA_ARGS__; \
typedef Reserved64Only##lp_bits Reserved64Only; \ using Reserved64Only = Reserved64Only##lp_bits; \
}; \ }; \
} \ } \
} \ } \

View File

@ -23,16 +23,16 @@
namespace { namespace {
struct ReadTraits { struct ReadTraits {
typedef void* VoidBufferType; using VoidBufferType = void*;
typedef char* CharBufferType; using CharBufferType = char*;
static ssize_t Operate(int fd, CharBufferType buffer, size_t size) { static ssize_t Operate(int fd, CharBufferType buffer, size_t size) {
return read(fd, buffer, size); return read(fd, buffer, size);
} }
}; };
struct WriteTraits { struct WriteTraits {
typedef const void* VoidBufferType; using VoidBufferType = const void*;
typedef const char* CharBufferType; using CharBufferType = const char*;
static ssize_t Operate(int fd, CharBufferType buffer, size_t size) { static ssize_t Operate(int fd, CharBufferType buffer, size_t size) {
return write(fd, buffer, size); return write(fd, buffer, size);
} }

View File

@ -152,7 +152,7 @@ enum MachMessageID : mach_msg_id_t {
kern_return_t MIGCheckRequestExceptionRaise( kern_return_t MIGCheckRequestExceptionRaise(
const __Request__exception_raise_t* in_request) { 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( return __MIG_check__Request__exception_raise_t(
const_cast<Request*>(in_request)); const_cast<Request*>(in_request));
} }
@ -160,7 +160,7 @@ kern_return_t MIGCheckRequestExceptionRaise(
kern_return_t MIGCheckRequestExceptionRaiseState( kern_return_t MIGCheckRequestExceptionRaiseState(
const __Request__exception_raise_state_t* in_request, const __Request__exception_raise_state_t* in_request,
const __Request__exception_raise_state_t** in_request_1) { 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( return __MIG_check__Request__exception_raise_state_t(
const_cast<Request*>(in_request), const_cast<Request**>(in_request_1)); const_cast<Request*>(in_request), const_cast<Request**>(in_request_1));
} }
@ -168,14 +168,14 @@ kern_return_t MIGCheckRequestExceptionRaiseState(
kern_return_t MIGCheckRequestExceptionRaiseStateIdentity( kern_return_t MIGCheckRequestExceptionRaiseStateIdentity(
const __Request__exception_raise_state_identity_t* in_request, const __Request__exception_raise_state_identity_t* in_request,
const __Request__exception_raise_state_identity_t** in_request_1) { 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( return __MIG_check__Request__exception_raise_state_identity_t(
const_cast<Request*>(in_request), const_cast<Request**>(in_request_1)); const_cast<Request*>(in_request), const_cast<Request**>(in_request_1));
} }
kern_return_t MIGCheckRequestMachExceptionRaise( kern_return_t MIGCheckRequestMachExceptionRaise(
const __Request__mach_exception_raise_t* in_request) { 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( return __MIG_check__Request__mach_exception_raise_t(
const_cast<Request*>(in_request)); const_cast<Request*>(in_request));
} }
@ -183,7 +183,7 @@ kern_return_t MIGCheckRequestMachExceptionRaise(
kern_return_t MIGCheckRequestMachExceptionRaiseState( kern_return_t MIGCheckRequestMachExceptionRaiseState(
const __Request__mach_exception_raise_state_t* in_request, const __Request__mach_exception_raise_state_t* in_request,
const __Request__mach_exception_raise_state_t** in_request_1) { 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( return __MIG_check__Request__mach_exception_raise_state_t(
const_cast<Request*>(in_request), const_cast<Request**>(in_request_1)); const_cast<Request*>(in_request), const_cast<Request**>(in_request_1));
} }
@ -191,7 +191,7 @@ kern_return_t MIGCheckRequestMachExceptionRaiseState(
kern_return_t MIGCheckRequestMachExceptionRaiseStateIdentity( kern_return_t MIGCheckRequestMachExceptionRaiseStateIdentity(
const __Request__mach_exception_raise_state_identity_t* in_request, const __Request__mach_exception_raise_state_identity_t* in_request,
const __Request__mach_exception_raise_state_identity_t** in_request_1) { 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( return __MIG_check__Request__mach_exception_raise_state_identity_t(
const_cast<Request*>(in_request), const_cast<Request**>(in_request_1)); const_cast<Request*>(in_request), const_cast<Request**>(in_request_1));
} }
@ -214,7 +214,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header,
switch (in_header->msgh_id) { switch (in_header->msgh_id) {
case kMachMessageIDExceptionRaise: { case kMachMessageIDExceptionRaise: {
// exception_raise(), catch_exception_raise(). // exception_raise(), catch_exception_raise().
typedef __Request__exception_raise_t Request; using Request = __Request__exception_raise_t;
const Request* in_request = reinterpret_cast<const Request*>(in_header); const Request* in_request = reinterpret_cast<const Request*>(in_header);
kern_return_t kr = MIGCheckRequestExceptionRaise(in_request); kern_return_t kr = MIGCheckRequestExceptionRaise(in_request);
if (kr != MACH_MSG_SUCCESS) { if (kr != MACH_MSG_SUCCESS) {
@ -222,7 +222,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header,
return true; return true;
} }
typedef __Reply__exception_raise_t Reply; using Reply = __Reply__exception_raise_t;
Reply* out_reply = reinterpret_cast<Reply*>(out_header); Reply* out_reply = reinterpret_cast<Reply*>(out_header);
out_reply->RetCode = out_reply->RetCode =
interface_->CatchExceptionRaise(in_header->msgh_local_port, interface_->CatchExceptionRaise(in_header->msgh_local_port,
@ -242,7 +242,7 @@ bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header,
case kMachMessageIDExceptionRaiseState: { case kMachMessageIDExceptionRaiseState: {
// exception_raise_state(), catch_exception_raise_state(). // 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<const Request*>(in_header); const Request* in_request = reinterpret_cast<const Request*>(in_header);
// in_request_1 is used for the portion of the request after the codes, // 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; return true;
} }
typedef __Reply__exception_raise_state_t Reply; using Reply = __Reply__exception_raise_state_t;
Reply* out_reply = reinterpret_cast<Reply*>(out_header); Reply* out_reply = reinterpret_cast<Reply*>(out_header);
out_reply->flavor = in_request_1->flavor; out_reply->flavor = in_request_1->flavor;
out_reply->new_stateCnt = arraysize(out_reply->new_state); 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: { case kMachMessageIDExceptionRaiseStateIdentity: {
// exception_raise_state_identity(), // exception_raise_state_identity(),
// catch_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<const Request*>(in_header); const Request* in_request = reinterpret_cast<const Request*>(in_header);
// in_request_1 is used for the portion of the request after the codes, // 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; return true;
} }
typedef __Reply__exception_raise_state_identity_t Reply; using Reply = __Reply__exception_raise_state_identity_t;
Reply* out_reply = reinterpret_cast<Reply*>(out_header); Reply* out_reply = reinterpret_cast<Reply*>(out_header);
out_reply->flavor = in_request_1->flavor; out_reply->flavor = in_request_1->flavor;
out_reply->new_stateCnt = arraysize(out_reply->new_state); out_reply->new_stateCnt = arraysize(out_reply->new_state);
@ -349,7 +349,7 @@ bool MachExcServer::MachMessageServerFunction(
switch (in_header->msgh_id) { switch (in_header->msgh_id) {
case kMachMessageIDMachExceptionRaise: { case kMachMessageIDMachExceptionRaise: {
// mach_exception_raise(), catch_mach_exception_raise(). // 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<const Request*>(in_header); const Request* in_request = reinterpret_cast<const Request*>(in_header);
kern_return_t kr = MIGCheckRequestMachExceptionRaise(in_request); kern_return_t kr = MIGCheckRequestMachExceptionRaise(in_request);
if (kr != MACH_MSG_SUCCESS) { if (kr != MACH_MSG_SUCCESS) {
@ -357,7 +357,7 @@ bool MachExcServer::MachMessageServerFunction(
return true; return true;
} }
typedef __Reply__mach_exception_raise_t Reply; using Reply = __Reply__mach_exception_raise_t;
Reply* out_reply = reinterpret_cast<Reply*>(out_header); Reply* out_reply = reinterpret_cast<Reply*>(out_header);
out_reply->RetCode = out_reply->RetCode =
interface_->CatchMachExceptionRaise(in_header->msgh_local_port, interface_->CatchMachExceptionRaise(in_header->msgh_local_port,
@ -377,7 +377,7 @@ bool MachExcServer::MachMessageServerFunction(
case kMachMessageIDMachExceptionRaiseState: { case kMachMessageIDMachExceptionRaiseState: {
// mach_exception_raise_state(), catch_mach_exception_raise_state(). // 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<const Request*>(in_header); const Request* in_request = reinterpret_cast<const Request*>(in_header);
// in_request_1 is used for the portion of the request after the codes, // in_request_1 is used for the portion of the request after the codes,
@ -390,7 +390,7 @@ bool MachExcServer::MachMessageServerFunction(
return true; return true;
} }
typedef __Reply__mach_exception_raise_state_t Reply; using Reply = __Reply__mach_exception_raise_state_t;
Reply* out_reply = reinterpret_cast<Reply*>(out_header); Reply* out_reply = reinterpret_cast<Reply*>(out_header);
out_reply->flavor = in_request_1->flavor; out_reply->flavor = in_request_1->flavor;
out_reply->new_stateCnt = arraysize(out_reply->new_state); out_reply->new_stateCnt = arraysize(out_reply->new_state);
@ -417,7 +417,7 @@ bool MachExcServer::MachMessageServerFunction(
case kMachMessageIDMachExceptionRaiseStateIdentity: { case kMachMessageIDMachExceptionRaiseStateIdentity: {
// mach_exception_raise_state_identity(), // mach_exception_raise_state_identity(),
// catch_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<const Request*>(in_header); const Request* in_request = reinterpret_cast<const Request*>(in_header);
// in_request_1 is used for the portion of the request after the codes, // in_request_1 is used for the portion of the request after the codes,
@ -430,7 +430,7 @@ bool MachExcServer::MachMessageServerFunction(
return true; 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<Reply*>(out_header); Reply* out_reply = reinterpret_cast<Reply*>(out_header);
out_reply->flavor = in_request_1->flavor; out_reply->flavor = in_request_1->flavor;
out_reply->new_stateCnt = arraysize(out_reply->new_state); out_reply->new_stateCnt = arraysize(out_reply->new_state);

View File

@ -268,7 +268,7 @@ struct __attribute__((packed, aligned(4))) ExceptionRaiseStateIdentityRequest {
// The reply messages for exception_raise_state and // The reply messages for exception_raise_state and
// exception_raise_state_identity are identical. // exception_raise_state_identity are identical.
typedef ExceptionRaiseStateReply ExceptionRaiseStateIdentityReply; using ExceptionRaiseStateIdentityReply = ExceptionRaiseStateReply;
struct __attribute__((packed, aligned(4))) MachExceptionRaiseRequest { struct __attribute__((packed, aligned(4))) MachExceptionRaiseRequest {
mach_msg_header_t Head; 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 // The reply messages for exception_raise and mach_exception_raise are
// identical. // identical.
typedef ExceptionRaiseReply MachExceptionRaiseReply; using MachExceptionRaiseReply = ExceptionRaiseReply;
struct __attribute__((packed, aligned(4))) MachExceptionRaiseStateRequest { struct __attribute__((packed, aligned(4))) MachExceptionRaiseStateRequest {
mach_msg_header_t Head; 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 // The reply messages for exception_raise_state and mach_exception_raise_state
// are identical. // are identical.
typedef ExceptionRaiseStateReply MachExceptionRaiseStateReply; using MachExceptionRaiseStateReply = ExceptionRaiseStateReply;
struct __attribute__((packed, struct __attribute__((packed,
aligned(4))) MachExceptionRaiseStateIdentityRequest { aligned(4))) MachExceptionRaiseStateIdentityRequest {
@ -382,7 +382,7 @@ struct __attribute__((packed,
// The reply messages for exception_raise_state_identity and // The reply messages for exception_raise_state_identity and
// mach_exception_raise_state_identity are identical. // mach_exception_raise_state_identity are identical.
typedef ExceptionRaiseStateIdentityReply MachExceptionRaiseStateIdentityReply; using MachExceptionRaiseStateIdentityReply = ExceptionRaiseStateIdentityReply;
// InvalidRequest and BadIDErrorReply are used to test that // InvalidRequest and BadIDErrorReply are used to test that
// UniversalMachExcServer deals appropriately with messages that it does not // UniversalMachExcServer deals appropriately with messages that it does not

View File

@ -153,7 +153,7 @@ class ExceptionPorts {
const char* TargetTypeName() const; const char* TargetTypeName() const;
private: private:
typedef kern_return_t (*GetExceptionPortsType)(mach_port_t, using GetExceptionPortsType = kern_return_t(*)(mach_port_t,
exception_mask_t, exception_mask_t,
exception_mask_array_t, exception_mask_array_t,
mach_msg_type_number_t*, mach_msg_type_number_t*,
@ -161,7 +161,7 @@ class ExceptionPorts {
exception_behavior_array_t, exception_behavior_array_t,
exception_flavor_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_mask_t,
exception_handler_t, exception_handler_t,
exception_behavior_t, exception_behavior_t,

View File

@ -134,7 +134,7 @@ const struct {
}; };
struct ConvertExceptionTraits { struct ConvertExceptionTraits {
typedef exception_type_t ValueType; using ValueType = exception_type_t;
static std::string SomethingToString( static std::string SomethingToString(
ValueType value, ValueType value,
SymbolicConstantToStringOptions options) { SymbolicConstantToStringOptions options) {
@ -309,7 +309,7 @@ const struct {
}; };
struct ConvertExceptionMaskTraits { struct ConvertExceptionMaskTraits {
typedef exception_mask_t ValueType; using ValueType = exception_mask_t;
static std::string SomethingToString( static std::string SomethingToString(
ValueType value, ValueType value,
SymbolicConstantToStringOptions options) { SymbolicConstantToStringOptions options) {
@ -552,7 +552,7 @@ const struct {
}; };
struct ConvertExceptionBehaviorTraits { struct ConvertExceptionBehaviorTraits {
typedef exception_behavior_t ValueType; using ValueType = exception_behavior_t;
static std::string SomethingToString( static std::string SomethingToString(
ValueType value, ValueType value,
SymbolicConstantToStringOptions options) { SymbolicConstantToStringOptions options) {
@ -815,7 +815,7 @@ const struct {
}; };
struct ConvertThreadStateFlavorTraits { struct ConvertThreadStateFlavorTraits {
typedef thread_state_flavor_t ValueType; using ValueType = thread_state_flavor_t;
static std::string SomethingToString( static std::string SomethingToString(
ValueType value, ValueType value,
SymbolicConstantToStringOptions options) { SymbolicConstantToStringOptions options) {

View File

@ -162,7 +162,7 @@ class InitializationStateDcheck : public InitializationState {
// without complaint even with warnings turned up. They take up no space at all, // 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 // and they can be “initialized” with the same () syntax used to initialize
// objects of the DCHECK_IS_ON InitializationStateDcheck class above. // objects of the DCHECK_IS_ON InitializationStateDcheck class above.
typedef bool InitializationStateDcheck[0]; using InitializationStateDcheck = bool[0];
namespace internal { namespace internal {

View File

@ -92,7 +92,7 @@ enum SymbolicConstantToStringOptionBits {
}; };
//! \brief A bitfield containing values of #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_*` //! \brief Options for various `StringTo*` functions in `symbolic_constants_*`
//! files. //! files.
@ -125,7 +125,7 @@ enum StringToSymbolicConstantOptionBits {
}; };
//! \brief A bitfield containing values of #StringToSymbolicConstantOptionBits. //! \brief A bitfield containing values of #StringToSymbolicConstantOptionBits.
typedef unsigned int StringToSymbolicConstantOptions; using StringToSymbolicConstantOptions = unsigned int;
} // namespace crashpad } // namespace crashpad

View File

@ -40,8 +40,8 @@ namespace {
template <typename TIntType, typename TLongType> template <typename TIntType, typename TLongType>
struct StringToIntegerTraits { struct StringToIntegerTraits {
typedef TIntType IntType; using IntType = TIntType;
typedef TLongType LongType; using LongType = TLongType;
static void TypeCheck() { static void TypeCheck() {
static_assert(std::numeric_limits<TIntType>::is_integer && static_assert(std::numeric_limits<TIntType>::is_integer &&
std::numeric_limits<TLongType>::is_integer, std::numeric_limits<TLongType>::is_integer,
@ -75,7 +75,7 @@ struct StringToSignedIntegerTraits
} }
private: private:
typedef StringToIntegerTraits<TIntType, TLongType> super; using super = StringToIntegerTraits<TIntType, TLongType>;
}; };
template <typename TIntType, typename TLongType> template <typename TIntType, typename TLongType>
@ -89,7 +89,7 @@ struct StringToUnsignedIntegerTraits
static bool IsNegativeOverflow(TLongType value) { return false; } static bool IsNegativeOverflow(TLongType value) { return false; }
private: private:
typedef StringToIntegerTraits<TIntType, TLongType> super; using super = StringToIntegerTraits<TIntType, TLongType>;
}; };
struct StringToIntTraits : public StringToSignedIntegerTraits<int, long> { struct StringToIntTraits : public StringToSignedIntegerTraits<int, long> {
@ -111,8 +111,8 @@ struct StringToUnsignedIntTraits
template <typename Traits> template <typename Traits>
bool StringToIntegerInternal(const base::StringPiece& string, bool StringToIntegerInternal(const base::StringPiece& string,
typename Traits::IntType* number) { typename Traits::IntType* number) {
typedef typename Traits::IntType IntType; using IntType = typename Traits::IntType;
typedef typename Traits::LongType LongType; using LongType = typename Traits::LongType;
Traits::TypeCheck(); Traits::TypeCheck();

View File

@ -72,7 +72,7 @@ struct ScopedDIRCloser {
} }
}; };
typedef scoped_ptr<DIR, ScopedDIRCloser> ScopedDIR; using ScopedDIR = scoped_ptr<DIR, ScopedDIRCloser>;
// This function implements CloseMultipleNowOrOnExec() using an operating // This function implements CloseMultipleNowOrOnExec() using an operating
// system-specific FD directory to determine which file descriptors are open. // system-specific FD directory to determine which file descriptors are open.