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
Родитель 62b0976290
Коммит de0979b930
26 изменённых файлов: 113 добавлений и 113 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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");

Просмотреть файл

@ -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 doesnt match (or
// cant be converted to) whats registered for the handler.

Просмотреть файл

@ -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

Просмотреть файл

@ -32,11 +32,11 @@
extern "C" {
#endif
// Dont use a typedef to account for the mach_header/mach_header_64 difference
// between the 32-bit and 64-bit versions of getsectiondata() and
// Dont 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__)

Просмотреть файл

@ -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;

Просмотреть файл

@ -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 <typename Traits>
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)] = {};

Просмотреть файл

@ -137,7 +137,7 @@ const MINIDUMP_HEADER* MinidumpWritableAtLocationDescriptor<MINIDUMP_HEADER>(
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) {

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

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

Просмотреть файл

@ -289,7 +289,7 @@ class 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,
// agree with the expectation in |thread_map|. If |tolerate_extra_threads| is

Просмотреть файл

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

Просмотреть файл

@ -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 <typename Traits> \
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. */ \

Просмотреть файл

@ -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; \
}; \
} \
} \

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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<Request*>(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<Request*>(in_request), const_cast<Request**>(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<Request*>(in_request), const_cast<Request**>(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<Request*>(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<Request*>(in_request), const_cast<Request**>(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<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) {
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<const Request*>(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<Reply*>(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<const Request*>(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<Reply*>(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<const Request*>(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<Reply*>(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<const Request*>(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<Reply*>(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<const Request*>(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<Reply*>(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<const Request*>(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<Reply*>(out_header);
out_reply->flavor = in_request_1->flavor;
out_reply->new_stateCnt = arraysize(out_reply->new_state);

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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

Просмотреть файл

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

Просмотреть файл

@ -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
// system-specific FD directory to determine which file descriptors are open.