diff options
author | 2021-07-14 12:45:13 +0100 | |
---|---|---|
committer | 2021-07-14 15:18:36 +0000 | |
commit | 4f990714b13e0b4446305a5411648a1a9ae42a7a (patch) | |
tree | 4568386e3e6f3c98c819851f6573e2c7cbc184fb /compiler | |
parent | 7744b69abf073101b09b9043f0f0eb109768fcfe (diff) |
Modernize typedefs with `using`.
Replace many occurences of `typedef` with `using`. For now,
do not update typedefs for function types and aligned types
and do not touch some parts such as jvmti or dmtracedump.
Test: m
Change-Id: Ie97ecbc5abf7e7109ef4b01f208752e2dc26c36d
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/debug/elf_debug_line_writer.h | 2 | ||||
-rw-r--r-- | compiler/optimizing/locations.h | 6 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 6 | ||||
-rw-r--r-- | compiler/utils/arm/constants_arm.h | 3 | ||||
-rw-r--r-- | compiler/utils/swap_space.h | 28 |
5 files changed, 22 insertions, 23 deletions
diff --git a/compiler/debug/elf_debug_line_writer.h b/compiler/debug/elf_debug_line_writer.h index e7b2a1b63a..8d62747c66 100644 --- a/compiler/debug/elf_debug_line_writer.h +++ b/compiler/debug/elf_debug_line_writer.h @@ -32,7 +32,7 @@ namespace art { namespace debug { -typedef std::vector<DexFile::PositionInfo> PositionInfos; +using PositionInfos = std::vector<DexFile::PositionInfo>; template<typename ElfTypes> class ElfDebugLineWriter { diff --git a/compiler/optimizing/locations.h b/compiler/optimizing/locations.h index 2a09921ba4..7bb754cfec 100644 --- a/compiler/optimizing/locations.h +++ b/compiler/optimizing/locations.h @@ -425,11 +425,11 @@ class Location : public ValueObject { return PayloadField::Decode(value_); } - typedef BitField<Kind, 0, kBitsForKind> KindField; - typedef BitField<uintptr_t, kBitsForKind, kBitsForPayload> PayloadField; + using KindField = BitField<Kind, 0, kBitsForKind>; + using PayloadField = BitField<uintptr_t, kBitsForKind, kBitsForPayload>; // Layout for kUnallocated locations payload. - typedef BitField<Policy, 0, 3> PolicyField; + using PolicyField = BitField<Policy, 0, 3>; // Layout for stack slots. static const intptr_t kStackIndexBias = diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 939c49f9a6..69ca520f5a 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -194,7 +194,7 @@ class HInstructionList : public ValueObject { class ReferenceTypeInfo : ValueObject { public: - typedef Handle<mirror::Class> TypeHandle; + using TypeHandle = Handle<mirror::Class>; static ReferenceTypeInfo Create(TypeHandle type_handle, bool is_exact); @@ -5705,7 +5705,7 @@ class HUShr final : public HBinaryOperation { template <typename T> static T Compute(T value, int32_t distance, int32_t max_shift_distance) { - typedef typename std::make_unsigned<T>::type V; + using V = std::make_unsigned_t<T>; V ux = static_cast<V>(value); return static_cast<T>(ux >> (distance & max_shift_distance)); } @@ -5862,7 +5862,7 @@ class HRor final : public HBinaryOperation { template <typename T> static T Compute(T value, int32_t distance, int32_t max_shift_value) { - typedef typename std::make_unsigned<T>::type V; + using V = std::make_unsigned_t<T>; V ux = static_cast<V>(value); if ((distance & max_shift_value) == 0) { return static_cast<T>(ux); diff --git a/compiler/utils/arm/constants_arm.h b/compiler/utils/arm/constants_arm.h index 688c09396f..f42fd9777b 100644 --- a/compiler/utils/arm/constants_arm.h +++ b/compiler/utils/arm/constants_arm.h @@ -119,8 +119,7 @@ enum Opcode { const int kRegisterSize = 4; // List of registers used in load/store multiple. -typedef uint16_t RegList; - +using RegList = uint16_t; } // namespace arm } // namespace art diff --git a/compiler/utils/swap_space.h b/compiler/utils/swap_space.h index 76df527108..a472943518 100644 --- a/compiler/utils/swap_space.h +++ b/compiler/utils/swap_space.h @@ -66,7 +66,7 @@ class SwapSpace { } }; - typedef std::set<SpaceChunk, SortChunkByPtr> FreeByStartSet; + using FreeByStartSet = std::set<SpaceChunk, SortChunkByPtr>; // Map size to an iterator to free_by_start_'s entry. struct FreeBySizeEntry { @@ -87,7 +87,7 @@ class SwapSpace { } } }; - typedef std::set<FreeBySizeEntry, FreeBySizeComparator> FreeBySizeSet; + using FreeBySizeSet = std::set<FreeBySizeEntry, FreeBySizeComparator>; SpaceChunk NewFileChunk(size_t min_size) REQUIRES(lock_); @@ -113,13 +113,13 @@ template <typename T> class SwapAllocator; template <> class SwapAllocator<void> { public: - typedef void value_type; - typedef void* pointer; - typedef const void* const_pointer; + using value_type = void; + using pointer = void*; + using const_pointer = const void*; template <typename U> struct rebind { - typedef SwapAllocator<U> other; + using other = SwapAllocator<U>; }; explicit SwapAllocator(SwapSpace* swap_space) : swap_space_(swap_space) {} @@ -145,17 +145,17 @@ class SwapAllocator<void> { template <typename T> class SwapAllocator { public: - typedef T value_type; - typedef T* pointer; - typedef T& reference; - typedef const T* const_pointer; - typedef const T& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; + using value_type = T; + using pointer = T*; + using reference = T&; + using const_pointer = const T*; + using const_reference = const T&; + using size_type = size_t; + using difference_type = ptrdiff_t; template <typename U> struct rebind { - typedef SwapAllocator<U> other; + using other = SwapAllocator<U>; }; explicit SwapAllocator(SwapSpace* swap_space) : swap_space_(swap_space) {} |