diff options
author | 2018-09-07 08:11:55 -0700 | |
---|---|---|
committer | 2018-09-07 09:13:50 -0700 | |
commit | fa6a1b0a1d9d186a0ad9bb413a4e49f1ffd187d8 (patch) | |
tree | 6d3bef945030868d7e78162dc3f4f35a07ce410a | |
parent | a0878aa9f4f4102e56a6381b28a8d7c38dec80b9 (diff) |
ART: Continue adding override annotations
Use Clang-tidy's modernize-use-override to add more annotations. Ignore
inferred annotations on destructors.
Bug: 32619234
Test: mmma art
Change-Id: Ic432c928e398d44df9171e42db04ee19946e6887
73 files changed, 138 insertions, 137 deletions
diff --git a/cmdline/cmdline_parser_test.cc b/cmdline/cmdline_parser_test.cc index 42c6a5ff59..97daafadd8 100644 --- a/cmdline/cmdline_parser_test.cc +++ b/cmdline/cmdline_parser_test.cc @@ -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 } diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc index fd17364c26..80c0a6883d 100644 --- a/compiler/exception_test.cc +++ b/compiler/exception_test.cc @@ -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()); diff --git a/compiler/optimizing/constructor_fence_redundancy_elimination.cc b/compiler/optimizing/constructor_fence_redundancy_elimination.cc index 3cb8bf2f47..3a1a9e023d 100644 --- a/compiler/optimizing/constructor_fence_redundancy_elimination.cc +++ b/compiler/optimizing/constructor_fence_redundancy_elimination.cc @@ -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(); } diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc index 7f71745a43..b33d0f488e 100644 --- a/compiler/optimizing/load_store_elimination.cc +++ b/compiler/optimizing/load_store_elimination.cc @@ -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) { diff --git a/compiler/optimizing/optimizing_cfi_test.cc b/compiler/optimizing/optimizing_cfi_test.cc index be1f7ea5b4..a52031cced 100644 --- a/compiler/optimizing/optimizing_cfi_test.cc +++ b/compiler/optimizing/optimizing_cfi_test.cc @@ -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(); } diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 0a747053cf..ff1207abab 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -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]; } diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc index a9d590232c..9079658e1c 100644 --- a/compiler/optimizing/reference_type_propagation.cc +++ b/compiler/optimizing/reference_type_propagation.cc @@ -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: diff --git a/compiler/utils/mips/assembler_mips32r5_test.cc b/compiler/utils/mips/assembler_mips32r5_test.cc index f9919f52b5..bd73c12dc5 100644 --- a/compiler/utils/mips/assembler_mips32r5_test.cc +++ b/compiler/utils/mips/assembler_mips32r5_test.cc @@ -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(); } diff --git a/compiler/utils/mips/assembler_mips32r6_test.cc b/compiler/utils/mips/assembler_mips32r6_test.cc index 1ec7a6a3e0..9637c25e7e 100644 --- a/compiler/utils/mips/assembler_mips32r6_test.cc +++ b/compiler/utils/mips/assembler_mips32r6_test.cc @@ -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(); } diff --git a/compiler/utils/mips/assembler_mips_test.cc b/compiler/utils/mips/assembler_mips_test.cc index 9527fa6ddd..f137c60eb8 100644 --- a/compiler/utils/mips/assembler_mips_test.cc +++ b/compiler/utils/mips/assembler_mips_test.cc @@ -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(); } diff --git a/compiler/utils/mips64/assembler_mips64_test.cc b/compiler/utils/mips64/assembler_mips64_test.cc index 4ceb356910..3218ae3a90 100644 --- a/compiler/utils/mips64/assembler_mips64_test.cc +++ b/compiler/utils/mips64/assembler_mips64_test.cc @@ -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(); } diff --git a/compiler/utils/x86_64/assembler_x86_64_test.cc b/compiler/utils/x86_64/assembler_x86_64_test.cc index e1de1f172f..65711e0855 100644 --- a/compiler/utils/x86_64/assembler_x86_64_test.cc +++ b/compiler/utils/x86_64/assembler_x86_64_test.cc @@ -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_; } diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc index 81932a90ce..523c90b8ef 100644 --- a/compiler/verifier_deps_test.cc +++ b/compiler/verifier_deps_test.cc @@ -52,7 +52,7 @@ 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_; @@ -60,7 +60,7 @@ class VerifierDepsCompilerCallbacks : public CompilerCallbacks { class VerifierDepsTest : public CommonCompilerTest { public: - void SetUpRuntimeOptions(RuntimeOptions* options) { + void SetUpRuntimeOptions(RuntimeOptions* options) override { CommonCompilerTest::SetUpRuntimeOptions(options); callbacks_.reset(new VerifierDepsCompilerCallbacks()); } diff --git a/dex2oat/linker/elf_writer_quick.cc b/dex2oat/linker/elf_writer_quick.cc index 852293bdb8..9a7f93d9fc 100644 --- a/dex2oat/linker/elf_writer_quick.cc +++ b/dex2oat/linker/elf_writer_quick.cc @@ -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_, diff --git a/dex2oat/linker/elf_writer_test.cc b/dex2oat/linker/elf_writer_test.cc index 40495f33ee..ef85fd16ff 100644 --- a/dex2oat/linker/elf_writer_test.cc +++ b/dex2oat/linker/elf_writer_test.cc @@ -34,7 +34,7 @@ namespace linker { class ElfWriterTest : public CommonCompilerTest { protected: - virtual void SetUp() { + void SetUp() override { ReserveImageSpace(); CommonCompilerTest::SetUp(); } diff --git a/dex2oat/linker/multi_oat_relative_patcher_test.cc b/dex2oat/linker/multi_oat_relative_patcher_test.cc index a5831b64b3..2610561683 100644 --- a/dex2oat/linker/multi_oat_relative_patcher_test.cc +++ b/dex2oat/linker/multi_oat_relative_patcher_test.cc @@ -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(); } diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc index f88d8d4cf6..e2db11f2aa 100644 --- a/dex2oat/linker/oat_writer.cc +++ b/dex2oat/linker/oat_writer.cc @@ -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"; diff --git a/dex2oat/linker/relative_patcher.cc b/dex2oat/linker/relative_patcher.cc index 564cf30f19..45a4a226d9 100644 --- a/dex2oat/linker/relative_patcher.cc +++ b/dex2oat/linker/relative_patcher.cc @@ -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."; } diff --git a/dexdump/dexdump_test.cc b/dexdump/dexdump_test.cc index 3a2d38dec6..bb6d4a4b9b 100644 --- a/dexdump/dexdump_test.cc +++ b/dexdump/dexdump_test.cc @@ -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]; diff --git a/dexlayout/dexdiag_test.cc b/dexlayout/dexdiag_test.cc index 60dd7e42a4..f936ff990c 100644 --- a/dexlayout/dexdiag_test.cc +++ b/dexlayout/dexdiag_test.cc @@ -34,7 +34,7 @@ static const char* kDexDiagBinaryName = "dexdiag"; class DexDiagTest : public CommonRuntimeTest { protected: - virtual void SetUp() { + void SetUp() override { CommonRuntimeTest::SetUp(); } diff --git a/dexlist/dexlist_test.cc b/dexlist/dexlist_test.cc index 68e67134cc..39e5f8cd99 100644 --- a/dexlist/dexlist_test.cc +++ b/dexlist/dexlist_test.cc @@ -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]; diff --git a/imgdiag/imgdiag.cc b/imgdiag/imgdiag.cc index 6ecf90151d..51b3d753d7 100644 --- a/imgdiag/imgdiag.cc +++ b/imgdiag/imgdiag.cc @@ -1731,7 +1731,7 @@ struct ImgDiagArgs : public CmdlineArgs { return kParseOk; } - virtual std::string GetUsage() const { + std::string GetUsage() const override { std::string usage; usage += @@ -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, diff --git a/imgdiag/imgdiag_test.cc b/imgdiag/imgdiag_test.cc index cb40c7d89d..73df2a2b03 100644 --- a/imgdiag/imgdiag_test.cc +++ b/imgdiag/imgdiag_test.cc @@ -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. diff --git a/libartbase/base/allocator.cc b/libartbase/base/allocator.cc index 1bcfe8720a..6393672859 100644 --- a/libartbase/base/allocator.cc +++ b/libartbase/base/allocator.cc @@ -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); } @@ -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. } diff --git a/libartbase/base/arena_bit_vector.cc b/libartbase/base/arena_bit_vector.cc index c6d899313d..138a5df77f 100644 --- a/libartbase/base/arena_bit_vector.cc +++ b/libartbase/base/arena_bit_vector.cc @@ -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) diff --git a/libartbase/base/unix_file/fd_file_test.cc b/libartbase/base/unix_file/fd_file_test.cc index 298b2d785f..9c39bb50ec 100644 --- a/libartbase/base/unix_file/fd_file_test.cc +++ b/libartbase/base/unix_file/fd_file_test.cc @@ -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); diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index ac9ece785a..51abaf441c 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -3424,7 +3424,7 @@ struct OatdumpArgs : public CmdlineArgs { return kParseOk; } - virtual std::string GetUsage() const { + std::string GetUsage() const override { std::string usage; usage += @@ -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_) { diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc index f1d6fb0b5d..1ed615bf3e 100644 --- a/openjdkjvmti/ti_class.cc +++ b/openjdkjvmti/ti_class.cc @@ -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(), @@ -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()) { diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc index 1588df4086..67645384ed 100644 --- a/openjdkjvmti/ti_method.cc +++ b/openjdkjvmti/ti_method.cc @@ -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 diff --git a/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc index 6d3a37e333..df29098ec4 100644 --- a/openjdkjvmti/ti_monitor.cc +++ b/openjdkjvmti/ti_monitor.cc @@ -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 diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc index b6969afff1..e2b98b3021 100644 --- a/openjdkjvmti/ti_stack.cc +++ b/openjdkjvmti/ti_stack.cc @@ -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; @@ -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) { @@ -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) { diff --git a/openjdkjvmti/ti_thread.cc b/openjdkjvmti/ti_thread.cc index e53309445d..41ef6c281d 100644 --- a/openjdkjvmti/ti_thread.cc +++ b/openjdkjvmti/ti_thread.cc @@ -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()); diff --git a/patchoat/patchoat_test.cc b/patchoat/patchoat_test.cc index 08bf31c4bd..6492b96b34 100644 --- a/patchoat/patchoat_test.cc +++ b/patchoat/patchoat_test.cc @@ -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()); diff --git a/runtime/barrier_test.cc b/runtime/barrier_test.cc index 88075ba368..5ec24bce17 100644 --- a/runtime/barrier_test.cc +++ b/runtime/barrier_test.cc @@ -32,7 +32,7 @@ class CheckWaitTask : public Task { count1_(count1), count2_(count2) {} - void Run(Thread* self) { + void Run(Thread* self) override { LOG(INFO) << "Before barrier" << *self; ++*count1_; barrier_->Wait(self); @@ -40,7 +40,7 @@ class CheckWaitTask : public Task { LOG(INFO) << "After barrier" << *self; } - virtual void Finalize() { + void Finalize() override { delete this; } @@ -91,7 +91,7 @@ class CheckPassTask : public Task { count_(count), subtasks_(subtasks) {} - void Run(Thread* self) { + void Run(Thread* self) override { for (size_t i = 0; i < subtasks_; ++i) { ++*count_; // Pass through to next subtask. @@ -99,7 +99,7 @@ class CheckPassTask : public Task { } } - void Finalize() { + void Finalize() override { delete this; } private: diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 511d468412..b014e5262f 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -1157,7 +1157,7 @@ class VerifyDeclaringClassVisitor : public ArtMethodVisitor { VerifyDeclaringClassVisitor() REQUIRES_SHARED(Locks::mutator_lock_, Locks::heap_bitmap_lock_) : live_bitmap_(Runtime::Current()->GetHeap()->GetLiveBitmap()) {} - virtual void Visit(ArtMethod* method) + void Visit(ArtMethod* method) override REQUIRES_SHARED(Locks::mutator_lock_, Locks::heap_bitmap_lock_) { ObjPtr<mirror::Class> klass = method->GetDeclaringClassUnchecked(); if (klass != nullptr) { @@ -1557,7 +1557,7 @@ static void VerifyAppImage(const ImageHeader& header, public: explicit VerifyClassInTableArtMethodVisitor(ClassTable* table) : table_(table) {} - virtual void Visit(ArtMethod* method) + void Visit(ArtMethod* method) override REQUIRES_SHARED(Locks::mutator_lock_, Locks::classlinker_classes_lock_) { ObjPtr<mirror::Class> klass = method->GetDeclaringClass(); if (klass != nullptr && !Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(klass)) { diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 366b5ec5e9..7103214df7 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -897,7 +897,7 @@ JDWP::JdwpError Dbg::GetOwnedMonitors(JDWP::ObjectId thread_id, // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses // annotalysis. - bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS { + bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS { if (!GetMethod()->IsRuntimeMethod()) { Monitor::VisitLocks(this, AppendOwnedMonitors, this); ++current_stack_depth; @@ -2406,7 +2406,7 @@ static int GetStackDepth(Thread* thread) REQUIRES_SHARED(Locks::mutator_lock_) { // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses // annotalysis. - bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS { + bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS { if (!GetMethod()->IsRuntimeMethod()) { ++depth; } @@ -2576,7 +2576,7 @@ struct GetThisVisitor : public StackVisitor { // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses // annotalysis. - virtual bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS { + bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS { if (frame_id != GetFrameId()) { return true; // continue } else { @@ -2618,7 +2618,7 @@ class FindFrameVisitor final : public StackVisitor { // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses // annotalysis. - bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS { + bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS { if (GetFrameId() != frame_id_) { return true; // Not our frame, carry on. } @@ -3831,7 +3831,7 @@ JDWP::JdwpError Dbg::ConfigureStep(JDWP::ObjectId thread_id, JDWP::JdwpStepSize // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses // annotalysis. - bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS { + bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS { ArtMethod* m = GetMethod(); if (!m->IsRuntimeMethod()) { ++stack_depth; diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc index eede5a56c0..d91cc2437d 100644 --- a/runtime/gc/collector/concurrent_copying.cc +++ b/runtime/gc/collector/concurrent_copying.cc @@ -423,7 +423,7 @@ class ConcurrentCopying::ThreadFlipVisitor : public Closure, public RootVisitor void VisitRoots(mirror::Object*** roots, size_t count, - const RootInfo& info ATTRIBUTE_UNUSED) + const RootInfo& info ATTRIBUTE_UNUSED) override REQUIRES_SHARED(Locks::mutator_lock_) { Thread* self = Thread::Current(); for (size_t i = 0; i < count; ++i) { @@ -440,7 +440,7 @@ class ConcurrentCopying::ThreadFlipVisitor : public Closure, public RootVisitor void VisitRoots(mirror::CompressedReference<mirror::Object>** roots, size_t count, - const RootInfo& info ATTRIBUTE_UNUSED) + const RootInfo& info ATTRIBUTE_UNUSED) override REQUIRES_SHARED(Locks::mutator_lock_) { Thread* self = Thread::Current(); for (size_t i = 0; i < count; ++i) { diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc index 23b2719bf0..5f44a72e19 100644 --- a/runtime/gc/collector/mark_sweep.cc +++ b/runtime/gc/collector/mark_sweep.cc @@ -789,12 +789,12 @@ class MarkSweep::MarkStackTask : public Task { mark_stack_[mark_stack_pos_++].Assign(obj); } - virtual void Finalize() { + void Finalize() override { delete this; } // Scans all of the objects - virtual void Run(Thread* self ATTRIBUTE_UNUSED) + void Run(Thread* self ATTRIBUTE_UNUSED) override REQUIRES(Locks::heap_bitmap_lock_) REQUIRES_SHARED(Locks::mutator_lock_) { ScanObjectParallelVisitor visitor(this); @@ -852,11 +852,11 @@ class MarkSweep::CardScanTask : public MarkStackTask<false> { const uint8_t minimum_age_; const bool clear_card_; - virtual void Finalize() { + void Finalize() override { delete this; } - virtual void Run(Thread* self) NO_THREAD_SAFETY_ANALYSIS { + void Run(Thread* self) override NO_THREAD_SAFETY_ANALYSIS { ScanObjectParallelVisitor visitor(this); accounting::CardTable* card_table = mark_sweep_->GetHeap()->GetCardTable(); size_t cards_scanned = clear_card_ @@ -1009,12 +1009,12 @@ class MarkSweep::RecursiveMarkTask : public MarkStackTask<false> { const uintptr_t begin_; const uintptr_t end_; - virtual void Finalize() { + void Finalize() override { delete this; } // Scans all of the objects - virtual void Run(Thread* self) NO_THREAD_SAFETY_ANALYSIS { + void Run(Thread* self) override NO_THREAD_SAFETY_ANALYSIS { ScanObjectParallelVisitor visitor(this); bitmap_->VisitMarkedRange(begin_, end_, visitor); // Finish by emptying our local mark stack. diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index e76d35d0f9..b6610b7518 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -2280,13 +2280,13 @@ class ZygoteCompactingCollector final : public collector::SemiSpace { } } - virtual bool ShouldSweepSpace(space::ContinuousSpace* space ATTRIBUTE_UNUSED) const { + bool ShouldSweepSpace(space::ContinuousSpace* space ATTRIBUTE_UNUSED) const override { // Don't sweep any spaces since we probably blasted the internal accounting of the free list // allocator. return false; } - virtual mirror::Object* MarkNonForwardedObject(mirror::Object* obj) + mirror::Object* MarkNonForwardedObject(mirror::Object* obj) override REQUIRES(Locks::heap_bitmap_lock_, Locks::mutator_lock_) { size_t obj_size = obj->SizeOf<kDefaultVerifyFlags>(); size_t alloc_size = RoundUp(obj_size, kObjectAlignment); diff --git a/runtime/gc/heap_test.cc b/runtime/gc/heap_test.cc index 7cbad3b523..05a04f21db 100644 --- a/runtime/gc/heap_test.cc +++ b/runtime/gc/heap_test.cc @@ -96,7 +96,7 @@ TEST_F(HeapTest, DumpGCPerformanceOnShutdown) { } class ZygoteHeapTest : public CommonRuntimeTest { - void SetUpRuntimeOptions(RuntimeOptions* options) { + void SetUpRuntimeOptions(RuntimeOptions* options) override { CommonRuntimeTest::SetUpRuntimeOptions(options); options->push_back(std::make_pair("-Xzygote", nullptr)); } diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc index fe4124d788..c212bad530 100644 --- a/runtime/gc/reference_processor.cc +++ b/runtime/gc/reference_processor.cc @@ -276,7 +276,7 @@ class ClearedReferenceTask : public HeapTask { explicit ClearedReferenceTask(jobject cleared_references) : HeapTask(NanoTime()), cleared_references_(cleared_references) { } - virtual void Run(Thread* thread) { + void Run(Thread* thread) override { ScopedObjectAccess soa(thread); jvalue args[1]; args[0].l = cleared_references_; diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index 3999e27333..b9c8e15798 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -1099,7 +1099,7 @@ class ImageSpace::Loader { fixup_heap_objects_(fixup_heap_objects), pointer_size_(pointer_size) {} - virtual void Visit(ArtMethod* method) NO_THREAD_SAFETY_ANALYSIS { + void Visit(ArtMethod* method) override NO_THREAD_SAFETY_ANALYSIS { // TODO: Separate visitor for runtime vs normal methods. if (UNLIKELY(method->IsRuntimeMethod())) { ImtConflictTable* table = method->GetImtConflictTable(pointer_size_); @@ -1132,7 +1132,7 @@ class ImageSpace::Loader { template<typename... Args> explicit FixupArtFieldVisitor(Args... args) : FixupVisitor(args...) {} - virtual void Visit(ArtField* field) NO_THREAD_SAFETY_ANALYSIS { + void Visit(ArtField* field) override NO_THREAD_SAFETY_ANALYSIS { field->UpdateObjects(ForwardObjectAdapter(this)); } }; diff --git a/runtime/gc/space/large_object_space_test.cc b/runtime/gc/space/large_object_space_test.cc index 9baa016dcd..d55ccd6e40 100644 --- a/runtime/gc/space/large_object_space_test.cc +++ b/runtime/gc/space/large_object_space_test.cc @@ -128,7 +128,7 @@ class AllocRaceTask : public Task { AllocRaceTask(size_t id, size_t iterations, size_t size, LargeObjectSpace* los) : id_(id), iterations_(iterations), size_(size), los_(los) {} - void Run(Thread* self) { + void Run(Thread* self) override { for (size_t i = 0; i < iterations_ ; ++i) { size_t alloc_size, bytes_tl_bulk_allocated; mirror::Object* ptr = los_->Alloc(self, size_, &alloc_size, nullptr, @@ -140,7 +140,7 @@ class AllocRaceTask : public Task { } } - virtual void Finalize() { + void Finalize() override { delete this; } diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc index b42433cad3..03fd964ffe 100644 --- a/runtime/instrumentation.cc +++ b/runtime/instrumentation.cc @@ -1385,7 +1385,7 @@ struct RuntimeMethodShortyVisitor : public StackVisitor { : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames), shorty('V') {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); if (m != nullptr && !m->IsRuntimeMethod()) { // The first Java method. diff --git a/runtime/jdwp/jdwp_adb.cc b/runtime/jdwp/jdwp_adb.cc index 481aff91f8..e6043c65de 100644 --- a/runtime/jdwp/jdwp_adb.cc +++ b/runtime/jdwp/jdwp_adb.cc @@ -87,13 +87,13 @@ struct JdwpAdbState : public JdwpNetStateBase { } } - virtual bool Accept() REQUIRES(!state_lock_); + bool Accept() override REQUIRES(!state_lock_); - virtual bool Establish(const JdwpOptions*) { + bool Establish(const JdwpOptions*) override { return false; } - virtual void Shutdown() REQUIRES(!state_lock_) { + void Shutdown() override REQUIRES(!state_lock_) { int control_sock; int local_clientSock; { @@ -116,7 +116,7 @@ struct JdwpAdbState : public JdwpNetStateBase { WakePipe(); } - virtual bool ProcessIncoming() REQUIRES(!state_lock_); + bool ProcessIncoming() override REQUIRES(!state_lock_); private: int ReceiveClientFd() REQUIRES(!state_lock_); diff --git a/runtime/jdwp/jdwp_socket.cc b/runtime/jdwp/jdwp_socket.cc index 673a942517..29fa1603dd 100644 --- a/runtime/jdwp/jdwp_socket.cc +++ b/runtime/jdwp/jdwp_socket.cc @@ -54,10 +54,10 @@ struct JdwpSocketState : public JdwpNetStateBase { remote_port_(0U) { } - virtual bool Accept(); - virtual bool Establish(const JdwpOptions*); - virtual void Shutdown(); - virtual bool ProcessIncoming(); + bool Accept() override; + bool Establish(const JdwpOptions*) override; + void Shutdown() override; + bool ProcessIncoming() override; private: in_addr remote_addr_; diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc index d9ef922390..9043f267fb 100644 --- a/runtime/jit/profile_saver.cc +++ b/runtime/jit/profile_saver.cc @@ -274,7 +274,7 @@ class GetClassesVisitor : public ClassVisitor { : profile_boot_class_path_(profile_boot_class_path), out_(out) {} - virtual bool operator()(ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_) { + bool operator()(ObjPtr<mirror::Class> klass) override REQUIRES_SHARED(Locks::mutator_lock_) { if (klass->IsProxyClass() || klass->IsArrayClass() || klass->IsPrimitive() || diff --git a/runtime/jni/java_vm_ext_test.cc b/runtime/jni/java_vm_ext_test.cc index 4049c6e699..dfe50cf905 100644 --- a/runtime/jni/java_vm_ext_test.cc +++ b/runtime/jni/java_vm_ext_test.cc @@ -27,7 +27,7 @@ namespace art { class JavaVmExtTest : public CommonRuntimeTest { protected: - virtual void SetUp() { + void SetUp() override { CommonRuntimeTest::SetUp(); vm_ = Runtime::Current()->GetJavaVM(); diff --git a/runtime/jni/jni_internal_test.cc b/runtime/jni/jni_internal_test.cc index 3040b905ec..4ad4c14e0b 100644 --- a/runtime/jni/jni_internal_test.cc +++ b/runtime/jni/jni_internal_test.cc @@ -34,7 +34,7 @@ using android::base::StringPrintf; // TODO: Convert to CommonRuntimeTest. Currently MakeExecutable is used. class JniInternalTest : public CommonCompilerTest { protected: - virtual void SetUp() { + void SetUp() override { CommonCompilerTest::SetUp(); vm_ = Runtime::Current()->GetJavaVM(); diff --git a/runtime/monitor_test.cc b/runtime/monitor_test.cc index c88748ffb8..0b168f86f4 100644 --- a/runtime/monitor_test.cc +++ b/runtime/monitor_test.cc @@ -62,7 +62,7 @@ class CreateTask : public Task { monitor_test_(monitor_test), initial_sleep_(initial_sleep), millis_(millis), expected_(expected) {} - void Run(Thread* self) { + void Run(Thread* self) override { { ScopedObjectAccess soa(self); @@ -118,7 +118,7 @@ class CreateTask : public Task { } } - void Finalize() { + void Finalize() override { delete this; } @@ -136,7 +136,7 @@ class UseTask : public Task { monitor_test_(monitor_test), initial_sleep_(initial_sleep), millis_(millis), expected_(expected) {} - void Run(Thread* self) { + void Run(Thread* self) override { monitor_test_->barrier_->Wait(self); // Wait for the other thread to set up the monitor. { @@ -158,7 +158,7 @@ class UseTask : public Task { monitor_test_->complete_barrier_->Wait(self); // Wait for test completion. } - void Finalize() { + void Finalize() override { delete this; } @@ -174,7 +174,7 @@ class InterruptTask : public Task { InterruptTask(MonitorTest* monitor_test, uint64_t initial_sleep, uint64_t millis) : monitor_test_(monitor_test), initial_sleep_(initial_sleep), millis_(millis) {} - void Run(Thread* self) { + void Run(Thread* self) override { monitor_test_->barrier_->Wait(self); // Wait for the other thread to set up the monitor. { @@ -202,7 +202,7 @@ class InterruptTask : public Task { monitor_test_->complete_barrier_->Wait(self); // Wait for test completion. } - void Finalize() { + void Finalize() override { delete this; } @@ -216,7 +216,7 @@ class WatchdogTask : public Task { public: explicit WatchdogTask(MonitorTest* monitor_test) : monitor_test_(monitor_test) {} - void Run(Thread* self) { + void Run(Thread* self) override { ScopedObjectAccess soa(self); monitor_test_->watchdog_object_.Get()->MonitorEnter(self); // Lock the object. @@ -231,7 +231,7 @@ class WatchdogTask : public Task { } } - void Finalize() { + void Finalize() override { delete this; } @@ -326,14 +326,14 @@ class TryLockTask : public Task { public: explicit TryLockTask(Handle<mirror::Object> obj) : obj_(obj) {} - void Run(Thread* self) { + void Run(Thread* self) override { ScopedObjectAccess soa(self); // Lock is held by other thread, try lock should fail. ObjectTryLock<mirror::Object> lock(self, obj_); EXPECT_FALSE(lock.Acquired()); } - void Finalize() { + void Finalize() override { delete this; } diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc index 39192274ad..e3932df5c0 100644 --- a/runtime/native/dalvik_system_VMStack.cc +++ b/runtime/native/dalvik_system_VMStack.cc @@ -113,7 +113,7 @@ static jobject VMStack_getClosestUserClassLoader(JNIEnv* env, jclass) { : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames), class_loader(nullptr) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { DCHECK(class_loader == nullptr); ObjPtr<mirror::Class> c = GetMethod()->GetDeclaringClass(); // c is null for runtime methods. diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc index 5a5fb16d0c..f5039d1929 100644 --- a/runtime/native/java_lang_Class.cc +++ b/runtime/native/java_lang_Class.cc @@ -62,7 +62,7 @@ static bool IsCallerTrusted(Thread* self) REQUIRES_SHARED(Locks::mutator_lock_) caller(nullptr) { } - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod *m = GetMethod(); if (m == nullptr) { // Attached native thread. Assume this is *not* boot class path. diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc index efdefb1eea..3a974df386 100644 --- a/runtime/oat_file_assistant_test.cc +++ b/runtime/oat_file_assistant_test.cc @@ -1148,7 +1148,7 @@ class RaceGenerateTask : public Task { loaded_oat_file_(nullptr) {} - void Run(Thread* self ATTRIBUTE_UNUSED) { + void Run(Thread* self ATTRIBUTE_UNUSED) override { // Load the dex files, and save a pointer to the loaded oat file, so that // we can verify only one oat file was loaded for the dex location. std::vector<std::unique_ptr<const DexFile>> dex_files; diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 7b92151c66..e882e7370a 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -165,7 +165,7 @@ class InstrumentationStackVisitor : public StackVisitor { CHECK_NE(frame_depth_, kInvalidFrameDepth); } - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { size_t current_frame_depth = GetFrameDepth(); if (current_frame_depth < frame_depth_) { CHECK(GetMethod() != nullptr); diff --git a/runtime/reflection_test.cc b/runtime/reflection_test.cc index 424ee0681a..00e298ead3 100644 --- a/runtime/reflection_test.cc +++ b/runtime/reflection_test.cc @@ -33,7 +33,7 @@ namespace art { // TODO: Convert to CommonRuntimeTest. Currently MakeExecutable is used. class ReflectionTest : public CommonCompilerTest { protected: - virtual void SetUp() { + void SetUp() override { CommonCompilerTest::SetUp(); vm_ = Runtime::Current()->GetJavaVM(); @@ -73,7 +73,7 @@ class ReflectionTest : public CommonCompilerTest { } } - virtual void TearDown() { + void TearDown() override { CleanUpJniEnv(); CommonCompilerTest::TearDown(); } diff --git a/runtime/runtime_callbacks_test.cc b/runtime/runtime_callbacks_test.cc index aaedb23e45..89f312457a 100644 --- a/runtime/runtime_callbacks_test.cc +++ b/runtime/runtime_callbacks_test.cc @@ -458,20 +458,20 @@ class MonitorWaitCallbacksTest : public RuntimeCallbacksTest { ref_ = { &k->GetDexFile(), k->GetDexClassDefIndex() }; } - void MonitorContendedLocking(Monitor* mon ATTRIBUTE_UNUSED) + void MonitorContendedLocking(Monitor* mon ATTRIBUTE_UNUSED) override REQUIRES_SHARED(Locks::mutator_lock_) { } - void MonitorContendedLocked(Monitor* mon ATTRIBUTE_UNUSED) + void MonitorContendedLocked(Monitor* mon ATTRIBUTE_UNUSED) override REQUIRES_SHARED(Locks::mutator_lock_) { } - void ObjectWaitStart(Handle<mirror::Object> obj, int64_t millis ATTRIBUTE_UNUSED) + void ObjectWaitStart(Handle<mirror::Object> obj, int64_t millis ATTRIBUTE_UNUSED) override REQUIRES_SHARED(Locks::mutator_lock_) { if (IsInterestingObject(obj.Get())) { saw_wait_start_ = true; } } - void MonitorWaitFinished(Monitor* m, bool timed_out ATTRIBUTE_UNUSED) + void MonitorWaitFinished(Monitor* m, bool timed_out ATTRIBUTE_UNUSED) override REQUIRES_SHARED(Locks::mutator_lock_) { if (IsInterestingObject(m->GetObject())) { saw_wait_finished_ = true; diff --git a/runtime/subtype_check_info_test.cc b/runtime/subtype_check_info_test.cc index e40bca57fe..53230930e6 100644 --- a/runtime/subtype_check_info_test.cc +++ b/runtime/subtype_check_info_test.cc @@ -86,11 +86,11 @@ BitString SetBitStringCharAt(BitString bit_string, size_t i, size_t val) { struct SubtypeCheckInfoTest : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { android::base::InitLogging(/*argv*/nullptr); } - virtual void TearDown() { + void TearDown() override { } static SubtypeCheckInfo MakeSubtypeCheckInfo(BitString path_to_root = {}, diff --git a/runtime/subtype_check_test.cc b/runtime/subtype_check_test.cc index 666bf812f5..9aa30325c2 100644 --- a/runtime/subtype_check_test.cc +++ b/runtime/subtype_check_test.cc @@ -301,13 +301,13 @@ struct MockScopedLockMutator { struct SubtypeCheckTest : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { android::base::InitLogging(/*argv*/nullptr); CreateRootedTree(BitString::kCapacity + 2u, BitString::kCapacity + 2u); } - virtual void TearDown() { + void TearDown() override { } void CreateRootedTree(size_t width, size_t height) { diff --git a/runtime/thread.cc b/runtime/thread.cc index 19fe4ea7c5..8a8f53743e 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -2515,7 +2515,7 @@ class FetchStackTraceVisitor : public StackVisitor { saved_frames_(saved_frames), max_saved_frames_(max_saved_frames) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { // We want to skip frames up to and including the exception's constructor. // Note we also skip the frame if it doesn't have a method (namely the callee // save frame) @@ -2603,7 +2603,7 @@ class BuildInternalStackTraceVisitor : public StackVisitor { self_->EndAssertNoThreadSuspension(nullptr); } - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { if (trace_ == nullptr) { return true; // We're probably trying to fillInStackTrace for an OutOfMemoryError. } @@ -3520,7 +3520,7 @@ class ReferenceMapVisitor : public StackVisitor { : StackVisitor(thread, context, StackVisitor::StackWalkKind::kSkipInlinedFrames), visitor_(visitor) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { if (false) { LOG(INFO) << "Visiting stack roots in " << ArtMethod::PrettyMethod(GetMethod()) << StringPrintf("@ PC:%04x", GetDexPc()); diff --git a/runtime/thread_pool_test.cc b/runtime/thread_pool_test.cc index d7842002ee..2600f55695 100644 --- a/runtime/thread_pool_test.cc +++ b/runtime/thread_pool_test.cc @@ -29,7 +29,7 @@ class CountTask : public Task { public: explicit CountTask(AtomicInteger* count) : count_(count), verbose_(false) {} - void Run(Thread* self) { + void Run(Thread* self) override { if (verbose_) { LOG(INFO) << "Running: " << *self; } @@ -39,7 +39,7 @@ class CountTask : public Task { ++*count_; } - void Finalize() { + void Finalize() override { if (verbose_) { LOG(INFO) << "Finalizing: " << *Thread::Current(); } @@ -129,7 +129,7 @@ class TreeTask : public Task { count_(count), depth_(depth) {} - void Run(Thread* self) { + void Run(Thread* self) override { if (depth_ > 1) { thread_pool_->AddTask(self, new TreeTask(thread_pool_, count_, depth_ - 1)); thread_pool_->AddTask(self, new TreeTask(thread_pool_, count_, depth_ - 1)); @@ -138,7 +138,7 @@ class TreeTask : public Task { ++*count_; } - void Finalize() { + void Finalize() override { delete this; } @@ -164,12 +164,12 @@ class PeerTask : public Task { public: PeerTask() {} - void Run(Thread* self) { + void Run(Thread* self) override { ScopedObjectAccess soa(self); CHECK(self->GetPeer() != nullptr); } - void Finalize() { + void Finalize() override { delete this; } }; @@ -178,12 +178,12 @@ class NoPeerTask : public Task { public: NoPeerTask() {} - void Run(Thread* self) { + void Run(Thread* self) override { ScopedObjectAccess soa(self); CHECK(self->GetPeer() == nullptr); } - void Finalize() { + void Finalize() override { delete this; } }; diff --git a/runtime/trace.cc b/runtime/trace.cc index 949fabe7f9..7e48bae581 100644 --- a/runtime/trace.cc +++ b/runtime/trace.cc @@ -64,7 +64,7 @@ class BuildStackTraceVisitor : public StackVisitor { : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames), method_trace_(Trace::AllocStackTrace()) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); // Ignore runtime frames (in particular callee save). if (!m->IsRuntimeMethod()) { diff --git a/test/004-ReferenceMap/stack_walk_refmap_jni.cc b/test/004-ReferenceMap/stack_walk_refmap_jni.cc index 1ce20e2b3d..4c344a3a5f 100644 --- a/test/004-ReferenceMap/stack_walk_refmap_jni.cc +++ b/test/004-ReferenceMap/stack_walk_refmap_jni.cc @@ -37,7 +37,7 @@ struct ReferenceMap2Visitor : public CheckReferenceMapVisitor { explicit ReferenceMap2Visitor(Thread* thread) REQUIRES_SHARED(Locks::mutator_lock_) : CheckReferenceMapVisitor(thread) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { if (CheckReferenceMapVisitor::VisitFrame()) { return true; } diff --git a/test/004-StackWalk/stack_walk_jni.cc b/test/004-StackWalk/stack_walk_jni.cc index 53e0dae13d..81c27ec400 100644 --- a/test/004-StackWalk/stack_walk_jni.cc +++ b/test/004-StackWalk/stack_walk_jni.cc @@ -33,7 +33,7 @@ class TestReferenceMapVisitor : public CheckReferenceMapVisitor { explicit TestReferenceMapVisitor(Thread* thread) REQUIRES_SHARED(Locks::mutator_lock_) : CheckReferenceMapVisitor(thread) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { if (CheckReferenceMapVisitor::VisitFrame()) { return true; } diff --git a/test/454-get-vreg/get_vreg_jni.cc b/test/454-get-vreg/get_vreg_jni.cc index 5fc5464d5f..eb81f3b6c8 100644 --- a/test/454-get-vreg/get_vreg_jni.cc +++ b/test/454-get-vreg/get_vreg_jni.cc @@ -34,7 +34,7 @@ class TestVisitor : public StackVisitor { this_value_(this_value), found_method_index_(0) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); diff --git a/test/457-regs/regs_jni.cc b/test/457-regs/regs_jni.cc index f867bdf17c..80abb3b406 100644 --- a/test/457-regs/regs_jni.cc +++ b/test/457-regs/regs_jni.cc @@ -32,7 +32,7 @@ class TestVisitor : public StackVisitor { REQUIRES_SHARED(Locks::mutator_lock_) : StackVisitor(thread, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); diff --git a/test/461-get-reference-vreg/get_reference_vreg_jni.cc b/test/461-get-reference-vreg/get_reference_vreg_jni.cc index 7eb3fe5ae6..ddc86dffa4 100644 --- a/test/461-get-reference-vreg/get_reference_vreg_jni.cc +++ b/test/461-get-reference-vreg/get_reference_vreg_jni.cc @@ -33,7 +33,7 @@ class TestVisitor : public StackVisitor { this_value_(this_value), found_method_index_(0) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); diff --git a/test/466-get-live-vreg/get_live_vreg_jni.cc b/test/466-get-live-vreg/get_live_vreg_jni.cc index 58ffe04fee..905d8e6db5 100644 --- a/test/466-get-live-vreg/get_live_vreg_jni.cc +++ b/test/466-get-live-vreg/get_live_vreg_jni.cc @@ -32,7 +32,7 @@ class TestVisitor : public StackVisitor { TestVisitor(Thread* thread, Context* context) REQUIRES_SHARED(Locks::mutator_lock_) : StackVisitor(thread, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); diff --git a/test/543-env-long-ref/env_long_ref.cc b/test/543-env-long-ref/env_long_ref.cc index ce5602f6e1..165f5bf412 100644 --- a/test/543-env-long-ref/env_long_ref.cc +++ b/test/543-env-long-ref/env_long_ref.cc @@ -34,7 +34,7 @@ class TestVisitor : public StackVisitor { found_(false), soa_(soa) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); diff --git a/test/570-checker-osr/osr.cc b/test/570-checker-osr/osr.cc index faec3c3534..7b88842fcc 100644 --- a/test/570-checker-osr/osr.cc +++ b/test/570-checker-osr/osr.cc @@ -35,7 +35,7 @@ class OsrVisitor : public StackVisitor { in_osr_method_(false), in_interpreter_(false) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); @@ -95,7 +95,7 @@ class ProfilingInfoVisitor : public StackVisitor { : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames), method_name_(method_name) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); @@ -129,7 +129,7 @@ class OsrCheckVisitor : public StackVisitor { : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames), method_name_(method_name) {} - bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { + bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); diff --git a/test/980-redefine-object/redef_object.cc b/test/980-redefine-object/redef_object.cc index b4d82ad76d..a8393dc1b3 100644 --- a/test/980-redefine-object/redef_object.cc +++ b/test/980-redefine-object/redef_object.cc @@ -80,13 +80,13 @@ static void JNICALL RedefineObjectHook(jvmtiEnv *jvmti_env, public: explicit JvmtiAllocator(jvmtiEnv* jvmti) : jvmti_(jvmti) {} - void* Allocate(size_t size) { + void* Allocate(size_t size) override { unsigned char* res = nullptr; jvmti_->Allocate(size, &res); return res; } - void Free(void* ptr) { + void Free(void* ptr) override { jvmti_->Deallocate(reinterpret_cast<unsigned char*>(ptr)); } diff --git a/test/ti-stress/stress.cc b/test/ti-stress/stress.cc index bd320c66cc..e123e9f081 100644 --- a/test/ti-stress/stress.cc +++ b/test/ti-stress/stress.cc @@ -92,7 +92,7 @@ static bool DoExtractClassFromData(jvmtiEnv* env, struct Allocator : public dex::Writer::Allocator { explicit Allocator(jvmtiEnv* jvmti_env) : jvmti_env_(jvmti_env) {} - virtual void* Allocate(size_t size) { + void* Allocate(size_t size) override { unsigned char* out = nullptr; if (JVMTI_ERROR_NONE != jvmti_env_->Allocate(size, &out)) { return nullptr; @@ -100,7 +100,7 @@ static bool DoExtractClassFromData(jvmtiEnv* env, return out; } } - virtual void Free(void* ptr) { + void Free(void* ptr) override { jvmti_env_->Deallocate(reinterpret_cast<unsigned char*>(ptr)); } private: diff --git a/tools/art_verifier/art_verifier.cc b/tools/art_verifier/art_verifier.cc index 8f412bf7a6..45c1a330cc 100644 --- a/tools/art_verifier/art_verifier.cc +++ b/tools/art_verifier/art_verifier.cc @@ -137,7 +137,7 @@ struct MethodVerifierArgs : public CmdlineArgs { return kParseOk; } - virtual std::string GetUsage() const { + std::string GetUsage() const override { std::string usage; usage += diff --git a/tools/titrace/instruction_decoder.cc b/tools/titrace/instruction_decoder.cc index d8fb713414..7f8b296bc3 100644 --- a/tools/titrace/instruction_decoder.cc +++ b/tools/titrace/instruction_decoder.cc @@ -32,7 +32,7 @@ class ClassInstructionDecoder : public InstructionDecoder { return Bytecode::ToString(op); } - virtual size_t LocationToOffset(size_t j_location) { + size_t LocationToOffset(size_t j_location) override { return j_location; } @@ -474,7 +474,7 @@ class DexInstructionDecoder : public InstructionDecoder { return Bytecode::ToString(op); } - virtual size_t LocationToOffset(size_t j_location) { + size_t LocationToOffset(size_t j_location) override { // dex pc is uint16_t*, but offset needs to be in bytes. return j_location * (sizeof(uint16_t) / sizeof(uint8_t)); } |