Skip to content

Commit

Permalink
Revert^2 "ART: Refactor typedef to using"
Browse files Browse the repository at this point in the history
This reverts commit ee07743.

Reason for revert: fixed attributes.

Bug: 32619234
Test: m test-art-host
Test: m test-art-target-gtest-unstarted_runtime_test
Change-Id: I6f0a775adfdf6ecd132b470f7c5446e949872e20
  • Loading branch information
agampe committed Sep 21, 2018
1 parent 89468ae commit c55bb39
Show file tree
Hide file tree
Showing 46 changed files with 151 additions and 153 deletions.
2 changes: 2 additions & 0 deletions build/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ art_clang_tidy_errors = [
"bugprone-virtual-near-miss",
"modernize-use-bool-literals",
"modernize-use-nullptr",
"modernize-use-using",
"performance-faster-string-find",
"performance-for-range-copy",
"performance-implicit-conversion-in-loop",
Expand All @@ -37,6 +38,7 @@ art_clang_tidy_errors_str = "bugprone-lambda-function-name"
+ ",modernize-redundant-void-arg"
+ ",modernize-use-bool-literals"
+ ",modernize-use-nullptr"
+ ",modernize-use-using"
+ ",performance-faster-string-find"
+ ",performance-for-range-copy"
+ ",performance-implicit-conversion-in-loop"
Expand Down
2 changes: 1 addition & 1 deletion compiler/dex/inline_method_analyser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace { // anonymous namespace
class Matcher {
public:
// Match function type.
typedef bool MatchFn(Matcher* matcher);
using MatchFn = bool(Matcher*);

template <size_t size>
static bool Match(const CodeItemDataAccessor* code_item, MatchFn* const (&pattern)[size]);
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizing/code_generator_x86.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8301,7 +8301,7 @@ void CodeGeneratorX86::PatchJitRootUse(uint8_t* code,
uint32_t code_offset = info.label.Position() - kLabelPositionToLiteralOffsetAdjustment;
uintptr_t address =
reinterpret_cast<uintptr_t>(roots_data) + index_in_table * sizeof(GcRoot<mirror::Object>);
typedef __attribute__((__aligned__(1))) uint32_t unaligned_uint32_t;
using unaligned_uint32_t __attribute__((__aligned__(1))) = uint32_t;
reinterpret_cast<unaligned_uint32_t*>(code + code_offset)[0] =
dchecked_integral_cast<uint32_t>(address);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizing/code_generator_x86_64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7542,7 +7542,7 @@ void CodeGeneratorX86_64::PatchJitRootUse(uint8_t* code,
uint32_t code_offset = info.label.Position() - kLabelPositionToLiteralOffsetAdjustment;
uintptr_t address =
reinterpret_cast<uintptr_t>(roots_data) + index_in_table * sizeof(GcRoot<mirror::Object>);
typedef __attribute__((__aligned__(1))) uint32_t unaligned_uint32_t;
using unaligned_uint32_t __attribute__((__aligned__(1))) = uint32_t;
reinterpret_cast<unaligned_uint32_t*>(code + code_offset)[0] =
dchecked_integral_cast<uint32_t>(address);
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/optimizing/graph_visualizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ std::ostream& operator<<(std::ostream& os, const StringList& list) {
}
}

typedef Disassembler* create_disasm_prototype(InstructionSet instruction_set,
DisassemblerOptions* options);
using create_disasm_prototype = Disassembler*(InstructionSet, DisassemblerOptions*);
class HGraphVisualizerDisassembler {
public:
HGraphVisualizerDisassembler(InstructionSet instruction_set,
Expand Down
4 changes: 2 additions & 2 deletions compiler/optimizing/parallel_move_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ class ParallelMoveTest : public ::testing::Test {
template<> const bool ParallelMoveTest<TestParallelMoveResolverWithSwap>::has_swap = true;
template<> const bool ParallelMoveTest<TestParallelMoveResolverNoSwap>::has_swap = false;

typedef ::testing::Types<TestParallelMoveResolverWithSwap, TestParallelMoveResolverNoSwap>
ParallelMoveResolverTestTypes;
using ParallelMoveResolverTestTypes =
::testing::Types<TestParallelMoveResolverWithSwap, TestParallelMoveResolverNoSwap>;

TYPED_TEST_CASE(ParallelMoveTest, ParallelMoveResolverTestTypes);

Expand Down
2 changes: 1 addition & 1 deletion compiler/utils/mips/assembler_mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void MipsAssembler::PatchCFI(size_t number_of_delayed_adjust_pcs) {
return;
}

typedef DebugFrameOpCodeWriterForAssembler::DelayedAdvancePC DelayedAdvancePC;
using DelayedAdvancePC = DebugFrameOpCodeWriterForAssembler::DelayedAdvancePC;
const auto data = cfi().ReleaseStreamAndPrepareForDelayedAdvancePC();
const std::vector<uint8_t>& old_stream = data.first;
const std::vector<DelayedAdvancePC>& advances = data.second;
Expand Down
12 changes: 6 additions & 6 deletions compiler/utils/mips/assembler_mips32r5_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class AssemblerMIPS32r5Test : public AssemblerTest<mips::MipsAssembler,
uint32_t,
mips::VectorRegister> {
public:
typedef AssemblerTest<mips::MipsAssembler,
mips::MipsLabel,
mips::Register,
mips::FRegister,
uint32_t,
mips::VectorRegister> Base;
using Base = AssemblerTest<mips::MipsAssembler,
mips::MipsLabel,
mips::Register,
mips::FRegister,
uint32_t,
mips::VectorRegister>;

// These tests were taking too long, so we hide the DriverStr() from AssemblerTest<>
// and reimplement it without the verification against `assembly_string`. b/73903608
Expand Down
12 changes: 6 additions & 6 deletions compiler/utils/mips/assembler_mips32r6_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class AssemblerMIPS32r6Test : public AssemblerTest<mips::MipsAssembler,
uint32_t,
mips::VectorRegister> {
public:
typedef AssemblerTest<mips::MipsAssembler,
mips::MipsLabel,
mips::Register,
mips::FRegister,
uint32_t,
mips::VectorRegister> Base;
using Base = AssemblerTest<mips::MipsAssembler,
mips::MipsLabel,
mips::Register,
mips::FRegister,
uint32_t,
mips::VectorRegister>;

// These tests were taking too long, so we hide the DriverStr() from AssemblerTest<>
// and reimplement it without the verification against `assembly_string`. b/73903608
Expand Down
10 changes: 5 additions & 5 deletions compiler/utils/mips/assembler_mips_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class AssemblerMIPSTest : public AssemblerTest<mips::MipsAssembler,
mips::FRegister,
uint32_t> {
public:
typedef AssemblerTest<mips::MipsAssembler,
mips::MipsLabel,
mips::Register,
mips::FRegister,
uint32_t> Base;
using Base = AssemblerTest<mips::MipsAssembler,
mips::MipsLabel,
mips::Register,
mips::FRegister,
uint32_t>;

// These tests were taking too long, so we hide the DriverStr() from AssemblerTest<>
// and reimplement it without the verification against `assembly_string`. b/73903608
Expand Down
2 changes: 1 addition & 1 deletion compiler/utils/mips64/assembler_mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void Mips64Assembler::PatchCFI() {
return;
}

typedef DebugFrameOpCodeWriterForAssembler::DelayedAdvancePC DelayedAdvancePC;
using DelayedAdvancePC = DebugFrameOpCodeWriterForAssembler::DelayedAdvancePC;
const auto data = cfi().ReleaseStreamAndPrepareForDelayedAdvancePC();
const std::vector<uint8_t>& old_stream = data.first;
const std::vector<DelayedAdvancePC>& advances = data.second;
Expand Down
12 changes: 6 additions & 6 deletions compiler/utils/mips64/assembler_mips64_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class AssemblerMIPS64Test : public AssemblerTest<mips64::Mips64Assembler,
uint32_t,
mips64::VectorRegister> {
public:
typedef AssemblerTest<mips64::Mips64Assembler,
mips64::Mips64Label,
mips64::GpuRegister,
mips64::FpuRegister,
uint32_t,
mips64::VectorRegister> Base;
using Base = AssemblerTest<mips64::Mips64Assembler,
mips64::Mips64Label,
mips64::GpuRegister,
mips64::FpuRegister,
uint32_t,
mips64::VectorRegister>;

// These tests were taking too long, so we hide the DriverStr() from AssemblerTest<>
// and reimplement it without the verification against `assembly_string`. b/73903608
Expand Down
10 changes: 5 additions & 5 deletions compiler/utils/x86/assembler_x86_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class AssemblerX86Test : public AssemblerTest<x86::X86Assembler,
x86::XmmRegister,
x86::Immediate> {
public:
typedef AssemblerTest<x86::X86Assembler,
x86::Address,
x86::Register,
x86::XmmRegister,
x86::Immediate> Base;
using Base = AssemblerTest<x86::X86Assembler,
x86::Address,
x86::Register,
x86::XmmRegister,
x86::Immediate>;

protected:
std::string GetArchitectureString() override {
Expand Down
10 changes: 5 additions & 5 deletions compiler/utils/x86_64/assembler_x86_64_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ class AssemblerX86_64Test : public AssemblerTest<x86_64::X86_64Assembler,
x86_64::XmmRegister,
x86_64::Immediate> {
public:
typedef AssemblerTest<x86_64::X86_64Assembler,
x86_64::Address,
x86_64::CpuRegister,
x86_64::XmmRegister,
x86_64::Immediate> Base;
using Base = AssemblerTest<x86_64::X86_64Assembler,
x86_64::Address,
x86_64::CpuRegister,
x86_64::XmmRegister,
x86_64::Immediate>;

protected:
// Get the typically used name for this architecture, e.g., aarch64, x86-64, ...
Expand Down
2 changes: 1 addition & 1 deletion dex2oat/linker/elf_writer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ TEST_F(ElfWriterTest, EncodeDecodeOatPatches) {
// Patch manually.
std::vector<uint8_t> expected = initial_data;
for (uintptr_t location : patch_locations) {
typedef __attribute__((__aligned__(1))) uint32_t UnalignedAddress;
using UnalignedAddress __attribute__((__aligned__(1))) = uint32_t;
*reinterpret_cast<UnalignedAddress*>(expected.data() + location) += delta;
}

Expand Down
4 changes: 2 additions & 2 deletions dex2oat/linker/oat_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ static constexpr bool kOatWriterForceOatCodeLayout = false;

static constexpr bool kOatWriterDebugOatCodeLayout = false;

typedef DexFile::Header __attribute__((aligned(1))) UnalignedDexFileHeader;
using UnalignedDexFileHeader __attribute__((__aligned__(1))) = DexFile::Header;

const UnalignedDexFileHeader* AsUnalignedDexFileHeader(const uint8_t* raw_data) {
return reinterpret_cast<const UnalignedDexFileHeader*>(raw_data);
return reinterpret_cast<const UnalignedDexFileHeader*>(raw_data);
}

class ChecksumUpdatingOutputStream : public OutputStream {
Expand Down
2 changes: 1 addition & 1 deletion dex2oat/linker/x86/relative_patcher_x86_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void X86BaseRelativePatcher::PatchCall(std::vector<uint8_t>* code,
uint32_t displacement = target_offset - patch_offset;
displacement -= kPcDisplacement; // The base PC is at the end of the 4-byte patch.

typedef __attribute__((__aligned__(1))) int32_t unaligned_int32_t;
using unaligned_int32_t __attribute__((__aligned__(1))) = int32_t;
reinterpret_cast<unaligned_int32_t*>(&(*code)[literal_offset])[0] = displacement;
}

Expand Down
2 changes: 1 addition & 1 deletion dex2oat/linker/x86_64/relative_patcher_x86_64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void X86_64RelativePatcher::PatchPcRelativeReference(std::vector<uint8_t>* code,
uint32_t displacement = target_offset - patch_offset;
displacement -= kPcDisplacement; // The base PC is at the end of the 4-byte patch.

typedef __attribute__((__aligned__(1))) int32_t unaligned_int32_t;
using unaligned_int32_t __attribute__((__aligned__(1))) = int32_t;
reinterpret_cast<unaligned_int32_t*>(&(*code)[patch.LiteralOffset()])[0] = displacement;
}

Expand Down
16 changes: 8 additions & 8 deletions dexdump/dexdump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ FILE* gOutFile = stdout;
/*
* Data types that match the definitions in the VM specification.
*/
typedef uint8_t u1;
typedef uint16_t u2;
typedef uint32_t u4;
typedef uint64_t u8;
typedef int8_t s1;
typedef int16_t s2;
typedef int32_t s4;
typedef int64_t s8;
using u1 = uint8_t;
using u2 = uint16_t;
using u4 = uint32_t;
using u8 = uint64_t;
using s1 = int8_t;
using s2 = int16_t;
using s4 = int32_t;
using s8 = int64_t;

/*
* Basic information about a field or a method.
Expand Down
6 changes: 3 additions & 3 deletions dexlist/dexlist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ static FILE* gOutFile = stdout;
/*
* Data types that match the definitions in the VM specification.
*/
typedef uint8_t u1;
typedef uint32_t u4;
typedef uint64_t u8;
using u1 = uint8_t;
using u4 = uint32_t;
using u8 = uint64_t;

/*
* Returns a newly-allocated string for the "dot version" of the class
Expand Down
12 changes: 6 additions & 6 deletions disassembler/disassembler_arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ class DisassemblerArm::CustomDisassembler final : public PrintDisassembler {
void DisassemblerArm::CustomDisassembler::CustomDisassemblerStream::PrintLiteral(LocationType type,
int32_t offset) {
// Literal offsets are not required to be aligned, so we may need unaligned access.
typedef const int16_t unaligned_int16_t __attribute__ ((aligned (1)));
typedef const uint16_t unaligned_uint16_t __attribute__ ((aligned (1)));
typedef const int32_t unaligned_int32_t __attribute__ ((aligned (1)));
typedef const int64_t unaligned_int64_t __attribute__ ((aligned (1)));
typedef const float unaligned_float __attribute__ ((aligned (1)));
typedef const double unaligned_double __attribute__ ((aligned (1)));
using unaligned_int16_t __attribute__((__aligned__(1))) = const int16_t;
using unaligned_uint16_t __attribute__((__aligned__(1))) = const uint16_t;
using unaligned_int32_t __attribute__((__aligned__(1))) = const int32_t;
using unaligned_int64_t __attribute__((__aligned__(1))) = const int64_t;
using unaligned_float __attribute__((__aligned__(1))) = const float;
using unaligned_double __attribute__((__aligned__(1))) = const double;

// Zeros are used for the LocationType values this function does not care about.
const size_t literal_size[kVst4Location + 1] = {
Expand Down
4 changes: 0 additions & 4 deletions libdexfile/dex/dex_file_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#include "standard_dex_file.h"
#include "ziparchive/zip_archive.h"

// system/core/zip_archive definitions.
struct ZipEntry;
typedef void* ZipArchiveHandle;

namespace art {

namespace {
Expand Down
4 changes: 2 additions & 2 deletions oatdump/oatdump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class OatDumper {
return instruction_set_;
}

typedef std::vector<std::unique_ptr<const DexFile>> DexFileUniqV;
using DexFileUniqV = std::vector<std::unique_ptr<const DexFile>>;

bool Dump(std::ostream& os) {
bool success = true;
Expand Down Expand Up @@ -2480,7 +2480,7 @@ class ImageDumper {
size_t bytes;
size_t count;
};
typedef SafeMap<std::string, SizeAndCount> SizeAndCountTable;
using SizeAndCountTable = SafeMap<std::string, SizeAndCount>;
SizeAndCountTable sizes_and_counts;

void Update(const char* descriptor, size_t object_bytes_in) {
Expand Down
7 changes: 2 additions & 5 deletions runtime/base/mutex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,15 @@ void BaseMutex::DumpAll(std::ostream& os) {
// No mutexes have been created yet during at startup.
return;
}
typedef std::set<BaseMutex*>::const_iterator It;
os << "(Contended)\n";
for (It it = all_mutexes->begin(); it != all_mutexes->end(); ++it) {
BaseMutex* mutex = *it;
for (const BaseMutex* mutex : *all_mutexes) {
if (mutex->HasEverContended()) {
mutex->Dump(os);
os << "\n";
}
}
os << "(Never contented)\n";
for (It it = all_mutexes->begin(); it != all_mutexes->end(); ++it) {
BaseMutex* mutex = *it;
for (const BaseMutex* mutex : *all_mutexes) {
if (!mutex->HasEverContended()) {
mutex->Dump(os);
os << "\n";
Expand Down
4 changes: 2 additions & 2 deletions runtime/class_linker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ struct FieldGapsComparator {
return lhs.size < rhs.size || (lhs.size == rhs.size && lhs.start_offset > rhs.start_offset);
}
};
typedef std::priority_queue<FieldGap, std::vector<FieldGap>, FieldGapsComparator> FieldGaps;
using FieldGaps = std::priority_queue<FieldGap, std::vector<FieldGap>, FieldGapsComparator>;

// Adds largest aligned gaps to queue of gaps.
static void AddFieldGap(uint32_t gap_start, uint32_t gap_end, FieldGaps* gaps) {
Expand Down Expand Up @@ -2301,7 +2301,7 @@ ObjPtr<mirror::Class> ClassLinker::EnsureResolved(Thread* self,
return klass;
}

typedef std::pair<const DexFile*, const DexFile::ClassDef*> ClassPathEntry;
using ClassPathEntry = std::pair<const DexFile*, const DexFile::ClassDef*>;

// Search a collection of DexFiles for a descriptor
ClassPathEntry FindInClassPath(const char* descriptor,
Expand Down
2 changes: 1 addition & 1 deletion runtime/elf_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ template <typename ElfTypes>
void ElfFileImpl<ElfTypes>::ApplyOatPatches(
const uint8_t* patches, const uint8_t* patches_end, Elf_Addr delta,
uint8_t* to_patch, const uint8_t* to_patch_end) {
typedef __attribute__((__aligned__(1))) Elf_Addr UnalignedAddress;
using UnalignedAddress __attribute__((__aligned__(1))) = Elf_Addr;
while (patches < patches_end) {
to_patch += DecodeUnsignedLeb128(&patches);
DCHECK_LE(patches, patches_end) << "Unexpected end of patch list.";
Expand Down
10 changes: 5 additions & 5 deletions runtime/hprof/hprof.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ enum HprofBasicType {
hprof_basic_long = 11,
};

typedef uint32_t HprofStringId;
typedef uint32_t HprofClassObjectId;
typedef uint32_t HprofClassSerialNumber;
typedef uint32_t HprofStackTraceSerialNumber;
typedef uint32_t HprofStackFrameId;
using HprofStringId = uint32_t;
using HprofClassObjectId = uint32_t;
using HprofClassSerialNumber = uint32_t;
using HprofStackTraceSerialNumber = uint32_t;
using HprofStackFrameId = uint32_t;
static constexpr HprofStackTraceSerialNumber kHprofNullStackTrace = 0;

class EndianOutput {
Expand Down
Loading

0 comments on commit c55bb39

Please sign in to comment.