Skip to content

Commit

Permalink
ART: Continue adding override annotations
Browse files Browse the repository at this point in the history
Use Clang-tidy's modernize-use-override to add more annotations. Ignore
inferred annotations on destructors.

Bug: 32619234
Test: mmma art
Change-Id: Ic432c928e398d44df9171e42db04ee19946e6887
  • Loading branch information
agampe committed Sep 7, 2018
1 parent a0878aa commit fa6a1b0
Show file tree
Hide file tree
Showing 73 changed files with 138 additions and 137 deletions.
2 changes: 1 addition & 1 deletion cmdline/cmdline_parser_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class CmdlineParserTest : public ::testing::Test {
art::InitLogging(nullptr, art::Runtime::Abort); // argv = null
}

virtual void SetUp() {
void SetUp() override {
parser_ = ParsedOptions::MakeParser(false); // do not ignore unrecognized options
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/exception_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ExceptionTest : public CommonRuntimeTest {
// which always points to the first source statement.
static constexpr const uint32_t kDexPc = 0;

virtual void SetUp() {
void SetUp() override {
CommonRuntimeTest::SetUp();

ScopedObjectAccess soa(Thread::Current());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class CFREVisitor : public HGraphVisitor {
VisitSetLocation(instruction, value);
}

void VisitDeoptimize(HDeoptimize* instruction ATTRIBUTE_UNUSED) {
void VisitDeoptimize(HDeoptimize* instruction ATTRIBUTE_UNUSED) override {
// Pessimize: Merge all fences.
MergeCandidateFences();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizing/load_store_elimination.cc
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ class LSEVisitor : public HGraphDelegateVisitor {
VisitSetLocation(instruction, idx, instruction->InputAt(2));
}

void VisitDeoptimize(HDeoptimize* instruction) {
void VisitDeoptimize(HDeoptimize* instruction) override {
const ScopedArenaVector<HInstruction*>& heap_values =
heap_values_for_[instruction->GetBlock()->GetBlockId()];
for (HInstruction* heap_value : heap_values) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizing/optimizing_cfi_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class OptimizingCFITest : public CFITest, public OptimizingUnitTestHelper {
public:
InternalCodeAllocator() {}

virtual uint8_t* Allocate(size_t size) {
uint8_t* Allocate(size_t size) override {
memory_.resize(size);
return memory_.data();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizing/optimizing_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CodeVectorAllocator final : public CodeAllocator {
explicit CodeVectorAllocator(ArenaAllocator* allocator)
: memory_(allocator->Adapter(kArenaAllocCodeBuffer)) {}

virtual uint8_t* Allocate(size_t size) {
uint8_t* Allocate(size_t size) override {
memory_.resize(size);
return &memory_[0];
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/optimizing/reference_type_propagation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ class ReferenceTypePropagation::RTPVisitor : public HGraphDelegateVisitor {
void VisitCheckCast(HCheckCast* instr) override;
void VisitBoundType(HBoundType* instr) override;
void VisitNullCheck(HNullCheck* instr) override;
void VisitPhi(HPhi* phi);
void VisitPhi(HPhi* phi) override;

void VisitBasicBlock(HBasicBlock* block);
void VisitBasicBlock(HBasicBlock* block) override;
void ProcessWorklist();

private:
Expand Down
2 changes: 1 addition & 1 deletion compiler/utils/mips/assembler_mips32r5_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class AssemblerMIPS32r5Test : public AssemblerTest<mips::MipsAssembler,
STLDeleteElements(&vec_registers_);
}

std::vector<mips::MipsLabel> GetAddresses() {
std::vector<mips::MipsLabel> GetAddresses() override {
UNIMPLEMENTED(FATAL) << "Feature not implemented yet";
UNREACHABLE();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/utils/mips/assembler_mips32r6_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class AssemblerMIPS32r6Test : public AssemblerTest<mips::MipsAssembler,
STLDeleteElements(&vec_registers_);
}

std::vector<mips::MipsLabel> GetAddresses() {
std::vector<mips::MipsLabel> GetAddresses() override {
UNIMPLEMENTED(FATAL) << "Feature not implemented yet";
UNREACHABLE();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/utils/mips/assembler_mips_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class AssemblerMIPSTest : public AssemblerTest<mips::MipsAssembler,
STLDeleteElements(&fp_registers_);
}

std::vector<mips::MipsLabel> GetAddresses() {
std::vector<mips::MipsLabel> GetAddresses() override {
UNIMPLEMENTED(FATAL) << "Feature not implemented yet";
UNREACHABLE();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/utils/mips64/assembler_mips64_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class AssemblerMIPS64Test : public AssemblerTest<mips64::Mips64Assembler,
STLDeleteElements(&vec_registers_);
}

std::vector<mips64::Mips64Label> GetAddresses() {
std::vector<mips64::Mips64Label> GetAddresses() override {
UNIMPLEMENTED(FATAL) << "Feature not implemented yet";
UNREACHABLE();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/utils/x86_64/assembler_x86_64_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class AssemblerX86_64Test : public AssemblerTest<x86_64::X86_64Assembler,
STLDeleteElements(&fp_registers_);
}

std::vector<x86_64::Address> GetAddresses() {
std::vector<x86_64::Address> GetAddresses() override {
return addresses_;
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/verifier_deps_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ class VerifierDepsCompilerCallbacks : public CompilerCallbacks {
bool IsRelocationPossible() override { return false; }

verifier::VerifierDeps* GetVerifierDeps() const override { return deps_; }
void SetVerifierDeps(verifier::VerifierDeps* deps) { deps_ = deps; }
void SetVerifierDeps(verifier::VerifierDeps* deps) override { deps_ = deps; }

private:
verifier::VerifierDeps* deps_;
};

class VerifierDepsTest : public CommonCompilerTest {
public:
void SetUpRuntimeOptions(RuntimeOptions* options) {
void SetUpRuntimeOptions(RuntimeOptions* options) override {
CommonCompilerTest::SetUpRuntimeOptions(options);
callbacks_.reset(new VerifierDepsCompilerCallbacks());
}
Expand Down
2 changes: 1 addition & 1 deletion dex2oat/linker/elf_writer_quick.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DebugInfoTask : public Task {
debug_info_(debug_info) {
}

void Run(Thread*) {
void Run(Thread*) override {
result_ = debug::MakeMiniDebugInfo(isa_,
instruction_set_features_,
text_section_address_,
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 @@ -34,7 +34,7 @@ namespace linker {

class ElfWriterTest : public CommonCompilerTest {
protected:
virtual void SetUp() {
void SetUp() override {
ReserveImageSpace();
CommonCompilerTest::SetUp();
}
Expand Down
4 changes: 2 additions & 2 deletions dex2oat/linker/multi_oat_relative_patcher_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ class MultiOatRelativePatcherTest : public testing::Test {

void PatchBakerReadBarrierBranch(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
const LinkerPatch& patch ATTRIBUTE_UNUSED,
uint32_t patch_offset ATTRIBUTE_UNUSED) {
uint32_t patch_offset ATTRIBUTE_UNUSED) override {
LOG(FATAL) << "UNIMPLEMENTED";
}

std::vector<debug::MethodDebugInfo> GenerateThunkDebugInfo(
uint32_t executable_offset ATTRIBUTE_UNUSED) {
uint32_t executable_offset ATTRIBUTE_UNUSED) override {
LOG(FATAL) << "UNIMPLEMENTED";
UNREACHABLE();
}
Expand Down
2 changes: 1 addition & 1 deletion dex2oat/linker/oat_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ class OatWriter::WriteCodeMethodVisitor : public OrderedMethodVisitor {
}
}

virtual bool VisitComplete() {
bool VisitComplete() override {
offset_ = writer_->relative_patcher_->WriteThunks(out_, offset_);
if (UNLIKELY(offset_ == 0u)) {
PLOG(ERROR) << "Failed to write final relative call thunks";
Expand Down
2 changes: 1 addition & 1 deletion dex2oat/linker/relative_patcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::unique_ptr<RelativePatcher> RelativePatcher::Create(

void PatchBakerReadBarrierBranch(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
const LinkerPatch& patch ATTRIBUTE_UNUSED,
uint32_t patch_offset ATTRIBUTE_UNUSED) {
uint32_t patch_offset ATTRIBUTE_UNUSED) override {
LOG(FATAL) << "Unexpected baker read barrier branch patch.";
}

Expand Down
2 changes: 1 addition & 1 deletion dexdump/dexdump_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace art {

class DexDumpTest : public CommonRuntimeTest {
protected:
virtual void SetUp() {
void SetUp() override {
CommonRuntimeTest::SetUp();
// Dogfood our own lib core dex file.
dex_file_ = GetLibCoreDexFileNames()[0];
Expand Down
2 changes: 1 addition & 1 deletion dexlayout/dexdiag_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static const char* kDexDiagBinaryName = "dexdiag";

class DexDiagTest : public CommonRuntimeTest {
protected:
virtual void SetUp() {
void SetUp() override {
CommonRuntimeTest::SetUp();
}

Expand Down
2 changes: 1 addition & 1 deletion dexlist/dexlist_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace art {

class DexListTest : public CommonRuntimeTest {
protected:
virtual void SetUp() {
void SetUp() override {
CommonRuntimeTest::SetUp();
// Dogfood our own lib core dex file.
dex_file_ = GetLibCoreDexFileNames()[0];
Expand Down
4 changes: 2 additions & 2 deletions imgdiag/imgdiag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ struct ImgDiagArgs : public CmdlineArgs {
return kParseOk;
}

virtual std::string GetUsage() const {
std::string GetUsage() const override {
std::string usage;

usage +=
Expand Down Expand Up @@ -1761,7 +1761,7 @@ struct ImgDiagArgs : public CmdlineArgs {
};

struct ImgDiagMain : public CmdlineMain<ImgDiagArgs> {
virtual bool ExecuteWithRuntime(Runtime* runtime) {
bool ExecuteWithRuntime(Runtime* runtime) override {
CHECK(args_ != nullptr);

return DumpImage(runtime,
Expand Down
2 changes: 1 addition & 1 deletion imgdiag/imgdiag_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static const pid_t kImgDiagGuaranteedBadPid = (PID_MAX_LIMIT + 1);

class ImgDiagTest : public CommonRuntimeTest {
protected:
virtual void SetUp() {
void SetUp() override {
CommonRuntimeTest::SetUp();

// We loaded the runtime with an explicit image. Therefore the image space must exist.
Expand Down
8 changes: 4 additions & 4 deletions libartbase/base/allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class MallocAllocator final : public Allocator {
MallocAllocator() {}
~MallocAllocator() {}

void* Alloc(size_t size) {
void* Alloc(size_t size) override {
return calloc(sizeof(uint8_t), size);
}

void Free(void* p) {
void Free(void* p) override {
free(p);
}

Expand All @@ -49,12 +49,12 @@ class NoopAllocator final : public Allocator {
NoopAllocator() {}
~NoopAllocator() {}

void* Alloc(size_t size ATTRIBUTE_UNUSED) {
void* Alloc(size_t size ATTRIBUTE_UNUSED) override {
LOG(FATAL) << "NoopAllocator::Alloc should not be called";
UNREACHABLE();
}

void Free(void* p ATTRIBUTE_UNUSED) {
void Free(void* p ATTRIBUTE_UNUSED) override {
// Noop.
}

Expand Down
4 changes: 2 additions & 2 deletions libartbase/base/arena_bit_vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ class ArenaBitVectorAllocator final : public Allocator, private ArenaBitVectorAl
UNREACHABLE();
}

virtual void* Alloc(size_t size) {
void* Alloc(size_t size) override {
return allocator_->Alloc(size, this->Kind());
}

virtual void Free(void*) {} // Nop.
void Free(void*) override {} // Nop.

private:
ArenaBitVectorAllocator(ArenaAlloc* allocator, ArenaAllocKind kind)
Expand Down
2 changes: 1 addition & 1 deletion libartbase/base/unix_file/fd_file_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace unix_file {

class FdFileTest : public RandomAccessFileTest {
protected:
virtual RandomAccessFile* MakeTestFile() {
RandomAccessFile* MakeTestFile() override {
FILE* tmp = tmpfile();
int fd = dup(fileno(tmp));
fclose(tmp);
Expand Down
4 changes: 2 additions & 2 deletions oatdump/oatdump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3424,7 +3424,7 @@ struct OatdumpArgs : public CmdlineArgs {
return kParseOk;
}

virtual std::string GetUsage() const {
std::string GetUsage() const override {
std::string usage;

usage +=
Expand Down Expand Up @@ -3578,7 +3578,7 @@ struct OatdumpMain : public CmdlineMain<OatdumpArgs> {
}
}

virtual bool ExecuteWithRuntime(Runtime* runtime) {
bool ExecuteWithRuntime(Runtime* runtime) override {
CHECK(args_ != nullptr);

if (!args_->imt_dump_.empty() || args_->imt_stat_dump_) {
Expand Down
5 changes: 3 additions & 2 deletions openjdkjvmti/ti_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ struct ClassCallback : public art::ClassLoadCallback {
}
}

void ClassLoad(art::Handle<art::mirror::Class> klass) REQUIRES_SHARED(art::Locks::mutator_lock_) {
void ClassLoad(art::Handle<art::mirror::Class> klass) override
REQUIRES_SHARED(art::Locks::mutator_lock_) {
if (event_handler->IsEventEnabledAnywhere(ArtJvmtiEvent::kClassLoad)) {
art::Thread* thread = art::Thread::Current();
ScopedLocalRef<jclass> jklass(thread->GetJniEnv(),
Expand All @@ -289,7 +290,7 @@ struct ClassCallback : public art::ClassLoadCallback {

void ClassPrepare(art::Handle<art::mirror::Class> temp_klass,
art::Handle<art::mirror::Class> klass)
REQUIRES_SHARED(art::Locks::mutator_lock_) {
override REQUIRES_SHARED(art::Locks::mutator_lock_) {
if (event_handler->IsEventEnabledAnywhere(ArtJvmtiEvent::kClassPrepare)) {
art::Thread* thread = art::Thread::Current();
if (temp_klass.Get() != klass.Get()) {
Expand Down
2 changes: 1 addition & 1 deletion openjdkjvmti/ti_method.cc
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ class GetLocalVariableClosure : public CommonLocalVariableClosure {
val_(val),
obj_val_(nullptr) {}

virtual jvmtiError GetResult() REQUIRES_SHARED(art::Locks::mutator_lock_) {
jvmtiError GetResult() override REQUIRES_SHARED(art::Locks::mutator_lock_) {
if (result_ == OK && type_ == art::Primitive::kPrimNot) {
val_->l = obj_val_.IsNull()
? nullptr
Expand Down
2 changes: 1 addition & 1 deletion openjdkjvmti/ti_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ jvmtiError MonitorUtil::GetCurrentContendedMonitor(jvmtiEnv* env ATTRIBUTE_UNUSE
public:
GetContendedMonitorClosure() : out_(nullptr) {}

void Run(art::Thread* target_thread) REQUIRES_SHARED(art::Locks::mutator_lock_) {
void Run(art::Thread* target_thread) override REQUIRES_SHARED(art::Locks::mutator_lock_) {
art::ScopedAssertNoThreadSuspension sants("GetContendedMonitorClosure::Run");
switch (target_thread->GetState()) {
// These three we are actually currently waiting on a monitor and have sent the appropriate
Expand Down
6 changes: 3 additions & 3 deletions openjdkjvmti/ti_stack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct GetStackTraceVisitor : public art::StackVisitor {
GetStackTraceVisitor(const GetStackTraceVisitor&) = default;
GetStackTraceVisitor(GetStackTraceVisitor&&) = default;

bool VisitFrame() REQUIRES_SHARED(art::Locks::mutator_lock_) {
bool VisitFrame() override REQUIRES_SHARED(art::Locks::mutator_lock_) {
art::ArtMethod* m = GetMethod();
if (m->IsRuntimeMethod()) {
return true;
Expand Down Expand Up @@ -662,7 +662,7 @@ struct GetFrameCountVisitor : public art::StackVisitor {
: art::StackVisitor(thread, nullptr, art::StackVisitor::StackWalkKind::kIncludeInlinedFrames),
count(0) {}

bool VisitFrame() REQUIRES_SHARED(art::Locks::mutator_lock_) {
bool VisitFrame() override REQUIRES_SHARED(art::Locks::mutator_lock_) {
art::ArtMethod* m = GetMethod();
const bool do_count = !(m == nullptr || m->IsRuntimeMethod());
if (do_count) {
Expand Down Expand Up @@ -734,7 +734,7 @@ struct GetLocationVisitor : public art::StackVisitor {
caller(nullptr),
caller_dex_pc(0) {}

bool VisitFrame() REQUIRES_SHARED(art::Locks::mutator_lock_) {
bool VisitFrame() override REQUIRES_SHARED(art::Locks::mutator_lock_) {
art::ArtMethod* m = GetMethod();
const bool do_count = !(m == nullptr || m->IsRuntimeMethod());
if (do_count) {
Expand Down
2 changes: 1 addition & 1 deletion openjdkjvmti/ti_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ jvmtiError ThreadUtil::StopThread(jvmtiEnv* env ATTRIBUTE_UNUSED,
public:
explicit StopThreadClosure(art::Handle<art::mirror::Throwable> except) : exception_(except) { }

void Run(art::Thread* me) REQUIRES_SHARED(art::Locks::mutator_lock_) {
void Run(art::Thread* me) override REQUIRES_SHARED(art::Locks::mutator_lock_) {
// Make sure the thread is prepared to notice the exception.
art::Runtime::Current()->GetInstrumentation()->InstrumentThreadStack(me);
me->SetAsyncException(exception_.Get());
Expand Down
2 changes: 1 addition & 1 deletion patchoat/patchoat_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ class PatchoatVerificationTest : public PatchoatTest {
ASSERT_EQ(rel_shortened_basenames, relocated_image_shortened_basenames);
}

virtual void TearDown() {
void TearDown() override {
if (!dex2oat_orig_dir_.empty()) {
ClearDirectory(dex2oat_orig_dir_.c_str(), /*recursive*/ true);
rmdir(dex2oat_orig_dir_.c_str());
Expand Down
Loading

0 comments on commit fa6a1b0

Please sign in to comment.