diff options
author | 2018-10-11 04:10:31 +0000 | |
---|---|---|
committer | 2018-10-11 04:10:31 +0000 | |
commit | 9bb9723258b5a2863e233a9cd61fc6fe3eb45d9c (patch) | |
tree | ff2109c11b499d0c73d7588ab2a58c8eb0763cd4 | |
parent | 4582ce314a4df5f4a67c7f3fb302eb9ac5e5a29e (diff) | |
parent | 9b031f7e4834b263ae531409a9f6c82cfdc89477 (diff) |
Merge "ART: Refactor for bugprone-argument-comment"
32 files changed, 217 insertions, 207 deletions
diff --git a/adbconnection/adbconnection.cc b/adbconnection/adbconnection.cc index ad941481fd..c716d92a9d 100644 --- a/adbconnection/adbconnection.cc +++ b/adbconnection/adbconnection.cc @@ -164,8 +164,8 @@ static jobject CreateAdbConnectionThread(art::Thread* thr) { art::WellKnownClasses::java_lang_Thread_init, thr_group.get(), thr_name.get(), - /*Priority*/ 0, - /*Daemon*/ true); + /*Priority=*/ 0, + /*Daemon=*/ true); } struct CallbackData { @@ -289,7 +289,7 @@ void AdbConnectionState::CloseFds() { // If the agent isn't loaded we might need to tell ddms code the connection is closed. if (!agent_loaded_ && notified_ddm_active_) { - NotifyDdms(/*active*/false); + NotifyDdms(/*active=*/false); } } @@ -605,7 +605,7 @@ void AdbConnectionState::RunPollLoop(art::Thread* self) { if (memcmp(kListenStartMessage, buf, sizeof(kListenStartMessage)) == 0) { agent_listening_ = true; if (adb_connection_socket_ != -1) { - SendAgentFds(/*require_handshake*/ !performed_handshake_); + SendAgentFds(/*require_handshake=*/ !performed_handshake_); } } else if (memcmp(kListenEndMessage, buf, sizeof(kListenEndMessage)) == 0) { agent_listening_ = false; @@ -647,7 +647,7 @@ void AdbConnectionState::RunPollLoop(art::Thread* self) { VLOG(jdwp) << "Sending fds as soon as we received them."; // The agent was already loaded so this must be after a disconnection. Therefore have the // transport perform the handshake. - SendAgentFds(/*require_handshake*/ true); + SendAgentFds(/*require_handshake=*/ true); } } else if (FlagsSet(control_sock_poll.revents, POLLRDHUP)) { // The other end of the adb connection just dropped it. @@ -663,7 +663,7 @@ void AdbConnectionState::RunPollLoop(art::Thread* self) { } else if (agent_listening_ && !sent_agent_fds_) { VLOG(jdwp) << "Sending agent fds again on data."; // Agent was already loaded so it can deal with the handshake. - SendAgentFds(/*require_handshake*/ true); + SendAgentFds(/*require_handshake=*/ true); } } else if (FlagsSet(adb_socket_poll.revents, POLLRDHUP)) { DCHECK(!agent_has_socket_); @@ -763,7 +763,7 @@ void AdbConnectionState::HandleDataWithoutAgent(art::Thread* self) { } if (!notified_ddm_active_) { - NotifyDdms(/*active*/ true); + NotifyDdms(/*active=*/ true); } uint32_t reply_type; std::vector<uint8_t> reply; @@ -826,9 +826,9 @@ void AdbConnectionState::PerformHandshake() { void AdbConnectionState::AttachJdwpAgent(art::Thread* self) { art::Runtime* runtime = art::Runtime::Current(); self->AssertNoPendingException(); - runtime->AttachAgent(/* JNIEnv */ nullptr, + runtime->AttachAgent(/* env= */ nullptr, MakeAgentArg(), - /* classloader */ nullptr); + /* class_loader= */ nullptr); if (self->IsExceptionPending()) { LOG(ERROR) << "Failed to load agent " << agent_name_; art::ScopedObjectAccess soa(self); diff --git a/dexlayout/compact_dex_writer.cc b/dexlayout/compact_dex_writer.cc index 00fb0af710..a04cfb65f9 100644 --- a/dexlayout/compact_dex_writer.cc +++ b/dexlayout/compact_dex_writer.cc @@ -26,7 +26,7 @@ namespace art { CompactDexWriter::CompactDexWriter(DexLayout* dex_layout) - : DexWriter(dex_layout, /*compute_offsets*/ true) { + : DexWriter(dex_layout, /*compute_offsets=*/ true) { CHECK(GetCompactDexLevel() != CompactDexLevel::kCompactDexLevelNone); } @@ -36,7 +36,7 @@ CompactDexLevel CompactDexWriter::GetCompactDexLevel() const { CompactDexWriter::Container::Container(bool dedupe_code_items) : code_item_dedupe_(dedupe_code_items, &data_section_), - data_item_dedupe_(/*dedupe*/ true, &data_section_) {} + data_item_dedupe_(/*enabled=*/ true, &data_section_) {} uint32_t CompactDexWriter::WriteDebugInfoOffsetTable(Stream* stream) { const uint32_t start_offset = stream->Tell(); @@ -211,7 +211,7 @@ void CompactDexWriter::WriteDebugInfoItem(Stream* stream, dex_ir::DebugInfoItem* CompactDexWriter::Deduper::Deduper(bool enabled, DexContainer::Section* section) : enabled_(enabled), - dedupe_map_(/*bucket_count*/ 32, + dedupe_map_(/*__n=*/ 32, HashedMemoryRange::HashEqual(section), HashedMemoryRange::HashEqual(section)) {} @@ -406,16 +406,16 @@ bool CompactDexWriter::Write(DexContainer* output, std::string* error_msg) { // Based on: https://source.android.com/devices/tech/dalvik/dex-format // Since the offsets may not be calculated already, the writing must be done in the correct order. const uint32_t string_ids_offset = main_stream->Tell(); - WriteStringIds(main_stream, /*reserve_only*/ true); + WriteStringIds(main_stream, /*reserve_only=*/ true); WriteTypeIds(main_stream); const uint32_t proto_ids_offset = main_stream->Tell(); - WriteProtoIds(main_stream, /*reserve_only*/ true); + WriteProtoIds(main_stream, /*reserve_only=*/ true); WriteFieldIds(main_stream); WriteMethodIds(main_stream); const uint32_t class_defs_offset = main_stream->Tell(); - WriteClassDefs(main_stream, /*reserve_only*/ true); + WriteClassDefs(main_stream, /*reserve_only=*/ true); const uint32_t call_site_ids_offset = main_stream->Tell(); - WriteCallSiteIds(main_stream, /*reserve_only*/ true); + WriteCallSiteIds(main_stream, /*reserve_only=*/ true); WriteMethodHandles(main_stream); if (compute_offsets_) { @@ -426,7 +426,7 @@ bool CompactDexWriter::Write(DexContainer* output, std::string* error_msg) { // Write code item first to minimize the space required for encoded methods. // For cdex, the code items don't depend on the debug info. - WriteCodeItems(data_stream, /*reserve_only*/ false); + WriteCodeItems(data_stream, /*reserve_only=*/ false); // Sort the debug infos by method index order, this reduces size by ~0.1% by reducing the size of // the debug info offset table. @@ -445,19 +445,19 @@ bool CompactDexWriter::Write(DexContainer* output, std::string* error_msg) { // Write delayed id sections that depend on data sections. { Stream::ScopedSeek seek(main_stream, string_ids_offset); - WriteStringIds(main_stream, /*reserve_only*/ false); + WriteStringIds(main_stream, /*reserve_only=*/ false); } { Stream::ScopedSeek seek(main_stream, proto_ids_offset); - WriteProtoIds(main_stream, /*reserve_only*/ false); + WriteProtoIds(main_stream, /*reserve_only=*/ false); } { Stream::ScopedSeek seek(main_stream, class_defs_offset); - WriteClassDefs(main_stream, /*reserve_only*/ false); + WriteClassDefs(main_stream, /*reserve_only=*/ false); } { Stream::ScopedSeek seek(main_stream, call_site_ids_offset); - WriteCallSiteIds(main_stream, /*reserve_only*/ false); + WriteCallSiteIds(main_stream, /*reserve_only=*/ false); } // Write the map list. diff --git a/dexlayout/dex_writer.cc b/dexlayout/dex_writer.cc index a4c5cda4ba..365171b855 100644 --- a/dexlayout/dex_writer.cc +++ b/dexlayout/dex_writer.cc @@ -790,16 +790,16 @@ bool DexWriter::Write(DexContainer* output, std::string* error_msg) { // Based on: https://source.android.com/devices/tech/dalvik/dex-format // Since the offsets may not be calculated already, the writing must be done in the correct order. const uint32_t string_ids_offset = stream->Tell(); - WriteStringIds(stream, /*reserve_only*/ true); + WriteStringIds(stream, /*reserve_only=*/ true); WriteTypeIds(stream); const uint32_t proto_ids_offset = stream->Tell(); - WriteProtoIds(stream, /*reserve_only*/ true); + WriteProtoIds(stream, /*reserve_only=*/ true); WriteFieldIds(stream); WriteMethodIds(stream); const uint32_t class_defs_offset = stream->Tell(); - WriteClassDefs(stream, /*reserve_only*/ true); + WriteClassDefs(stream, /*reserve_only=*/ true); const uint32_t call_site_ids_offset = stream->Tell(); - WriteCallSiteIds(stream, /*reserve_only*/ true); + WriteCallSiteIds(stream, /*reserve_only=*/ true); WriteMethodHandles(stream); uint32_t data_offset_ = 0u; @@ -812,13 +812,13 @@ bool DexWriter::Write(DexContainer* output, std::string* error_msg) { // Write code item first to minimize the space required for encoded methods. // Reserve code item space since we need the debug offsets to actually write them. const uint32_t code_items_offset = stream->Tell(); - WriteCodeItems(stream, /*reserve_only*/ true); + WriteCodeItems(stream, /*reserve_only=*/ true); // Write debug info section. WriteDebugInfoItems(stream); { // Actually write code items since debug info offsets are calculated now. Stream::ScopedSeek seek(stream, code_items_offset); - WriteCodeItems(stream, /*reserve_only*/ false); + WriteCodeItems(stream, /*reserve_only=*/ false); } WriteEncodedArrays(stream); @@ -833,19 +833,19 @@ bool DexWriter::Write(DexContainer* output, std::string* error_msg) { // Write delayed id sections that depend on data sections. { Stream::ScopedSeek seek(stream, string_ids_offset); - WriteStringIds(stream, /*reserve_only*/ false); + WriteStringIds(stream, /*reserve_only=*/ false); } { Stream::ScopedSeek seek(stream, proto_ids_offset); - WriteProtoIds(stream, /*reserve_only*/ false); + WriteProtoIds(stream, /*reserve_only=*/ false); } { Stream::ScopedSeek seek(stream, class_defs_offset); - WriteClassDefs(stream, /*reserve_only*/ false); + WriteClassDefs(stream, /*reserve_only=*/ false); } { Stream::ScopedSeek seek(stream, call_site_ids_offset); - WriteCallSiteIds(stream, /*reserve_only*/ false); + WriteCallSiteIds(stream, /*reserve_only=*/ false); } // Write the map list. diff --git a/dexlayout/dexdiag.cc b/dexlayout/dexdiag.cc index 493a8a2793..7a849f2898 100644 --- a/dexlayout/dexdiag.cc +++ b/dexlayout/dexdiag.cc @@ -294,7 +294,7 @@ static void ProcessOneDexMapping(uint64_t* pagemap, { Options options; std::unique_ptr<dex_ir::Header> header(dex_ir::DexIrBuilder(*dex_file, - /*eagerly_assign_offsets*/ true, + /*eagerly_assign_offsets=*/ true, options)); sections = dex_ir::GetSortedDexFileSections(header.get(), dex_ir::SortDirection::kSortDescending); @@ -321,9 +321,9 @@ static bool DisplayMappingIfFromVdexFile(pm_map_t* map, Printer* printer) { // Extract all the dex files from the vdex file. std::string error_msg; std::unique_ptr<VdexFile> vdex(VdexFile::Open(vdex_name, - false /*writeable*/, - false /*low_4gb*/, - false /*unquicken */, + /*writable=*/ false, + /*low_4gb=*/ false, + /*unquicken= */ false, &error_msg /*out*/)); if (vdex == nullptr) { std::cerr << "Could not open vdex file " diff --git a/dexlayout/dexdiag_test.cc b/dexlayout/dexdiag_test.cc index f936ff990c..d3bfd144c3 100644 --- a/dexlayout/dexdiag_test.cc +++ b/dexlayout/dexdiag_test.cc @@ -68,14 +68,14 @@ class DexDiagTest : public CommonRuntimeTest { EXPECT_TRUE(!oat_location.empty()); std::cout << "==" << oat_location << std::endl; std::string error_msg; - std::unique_ptr<OatFile> oat(OatFile::Open(/* zip_fd */ -1, + std::unique_ptr<OatFile> oat(OatFile::Open(/* zip_fd= */ -1, oat_location.c_str(), oat_location.c_str(), - /* requested_base */ nullptr, - /* executable */ false, - /* low_4gb */ false, - /* abs_dex_location */ nullptr, - /* reservation */ nullptr, + /* requested_base= */ nullptr, + /* executable= */ false, + /* low_4gb= */ false, + /* abs_dex_location= */ nullptr, + /* reservation= */ nullptr, &error_msg)); EXPECT_TRUE(oat != nullptr) << error_msg; return oat; diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc index 1b8412d86a..db6945fbaa 100644 --- a/dexlayout/dexlayout.cc +++ b/dexlayout/dexlayout.cc @@ -1914,10 +1914,10 @@ bool DexLayout::ProcessDexFile(const char* file_name, data_section->Begin(), data_section->Size(), location, - /* checksum */ 0, - /*oat_dex_file*/ nullptr, + /* location_checksum= */ 0, + /*oat_dex_file=*/ nullptr, verify, - /*verify_checksum*/ false, + /*verify_checksum=*/ false, error_msg)); CHECK(output_dex_file != nullptr) << "Failed to re-open output file:" << *error_msg; @@ -1928,11 +1928,11 @@ bool DexLayout::ProcessDexFile(const char* file_name, // Regenerate output IR to catch any bugs that might happen during writing. std::unique_ptr<dex_ir::Header> output_header( dex_ir::DexIrBuilder(*output_dex_file, - /*eagerly_assign_offsets*/ true, + /*eagerly_assign_offsets=*/ true, GetOptions())); std::unique_ptr<dex_ir::Header> orig_header( dex_ir::DexIrBuilder(*dex_file, - /*eagerly_assign_offsets*/ true, + /*eagerly_assign_offsets=*/ true, GetOptions())); CHECK(VerifyOutputDexFile(output_header.get(), orig_header.get(), error_msg)) << *error_msg; } @@ -1955,7 +1955,7 @@ int DexLayout::ProcessFile(const char* file_name) { const ArtDexFileLoader dex_file_loader; std::vector<std::unique_ptr<const DexFile>> dex_files; if (!dex_file_loader.Open( - file_name, file_name, /* verify */ true, verify_checksum, &error_msg, &dex_files)) { + file_name, file_name, /* verify= */ true, verify_checksum, &error_msg, &dex_files)) { // Display returned error message to user. Note that this error behavior // differs from the error messages shown by the original Dalvik dexdump. LOG(ERROR) << error_msg; @@ -1972,7 +1972,7 @@ int DexLayout::ProcessFile(const char* file_name) { if (!ProcessDexFile(file_name, dex_files[i].get(), i, - /*dex_container*/ nullptr, + /*dex_container=*/ nullptr, &error_msg)) { LOG(WARNING) << "Failed to run dex file " << i << " in " << file_name << " : " << error_msg; } diff --git a/dexlayout/dexlayout_main.cc b/dexlayout/dexlayout_main.cc index 78a8dd64ae..d212e71f06 100644 --- a/dexlayout/dexlayout_main.cc +++ b/dexlayout/dexlayout_main.cc @@ -203,7 +203,7 @@ int DexlayoutDriver(int argc, char** argv) { } // Create DexLayout instance. - DexLayout dex_layout(options, profile_info.get(), out_file, /*header*/ nullptr); + DexLayout dex_layout(options, profile_info.get(), out_file, /*header=*/ nullptr); // Process all files supplied on command line. int result = 0; diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc index 187c68790a..54157d9e3a 100644 --- a/dexlayout/dexlayout_test.cc +++ b/dexlayout/dexlayout_test.cc @@ -298,7 +298,7 @@ class DexLayoutTest : public CommonRuntimeTest { for (const std::string& dex_file : GetLibCoreDexFileNames()) { std::vector<std::string> dexlayout_args = { "-w", tmp_dir, "-o", tmp_name, dex_file }; - if (!DexLayoutExec(dexlayout_args, error_msg, /*pass_default_cdex_option*/ false)) { + if (!DexLayoutExec(dexlayout_args, error_msg, /*pass_default_cdex_option=*/ false)) { return false; } std::string dex_file_name = "classes.dex"; @@ -333,8 +333,8 @@ class DexLayoutTest : public CommonRuntimeTest { const ArtDexFileLoader dex_file_loader; bool result = dex_file_loader.Open(input_dex.c_str(), input_dex, - /*verify*/ true, - /*verify_checksum*/ false, + /*verify=*/ true, + /*verify_checksum=*/ false, &error_msg, &dex_files); @@ -359,7 +359,7 @@ class DexLayoutTest : public CommonRuntimeTest { pfi.AddMethodIndex(static_cast<ProfileCompilationInfo::MethodHotness::Flag>(flags), dex_location, dex_file->GetLocationChecksum(), - /*dex_method_idx*/i, + /*method_idx=*/i, dex_file->NumMethodIds()); } DexCacheResolvedClasses cur_classes(dex_location, @@ -447,7 +447,7 @@ class DexLayoutTest : public CommonRuntimeTest { // -v makes sure that the layout did not corrupt the dex file. std::vector<std::string> dexlayout_args = { "-i", "-v", "-w", tmp_dir, "-o", tmp_name, "-p", profile_file, dex_file }; - if (!DexLayoutExec(dexlayout_args, error_msg, /*pass_default_cdex_option*/ false)) { + if (!DexLayoutExec(dexlayout_args, error_msg, /*pass_default_cdex_option=*/ false)) { return false; } @@ -459,7 +459,7 @@ class DexLayoutTest : public CommonRuntimeTest { // -i since the checksum won't match from the first layout. std::vector<std::string> second_dexlayout_args = { "-i", "-v", "-w", tmp_dir, "-o", tmp_name, "-p", profile_file, output_dex }; - if (!DexLayoutExec(second_dexlayout_args, error_msg, /*pass_default_cdex_option*/ false)) { + if (!DexLayoutExec(second_dexlayout_args, error_msg, /*pass_default_cdex_option=*/ false)) { return false; } @@ -493,7 +493,7 @@ class DexLayoutTest : public CommonRuntimeTest { std::string output_dex = tmp_dir + "classes.dex.new"; std::vector<std::string> dexlayout_args = { "-w", tmp_dir, "-o", "/dev/null", input_dex }; - if (!DexLayoutExec(dexlayout_args, error_msg, /*pass_default_cdex_option*/ false)) { + if (!DexLayoutExec(dexlayout_args, error_msg, /*pass_default_cdex_option=*/ false)) { return false; } @@ -615,7 +615,7 @@ TEST_F(DexLayoutTest, DuplicateOffset) { { "-a", "-i", "-o", "/dev/null", temp_dex.GetFilename() }; ASSERT_TRUE(DexLayoutExec(&temp_dex, kDexFileDuplicateOffset, - nullptr /* profile_file */, + /* profile_file= */ nullptr, dexlayout_args)); } @@ -624,7 +624,7 @@ TEST_F(DexLayoutTest, NullSetRefListElement) { std::vector<std::string> dexlayout_args = { "-o", "/dev/null", temp_dex.GetFilename() }; ASSERT_TRUE(DexLayoutExec(&temp_dex, kNullSetRefListElementInputDex, - nullptr /* profile_file */, + /* profile_file= */ nullptr, dexlayout_args)); } @@ -666,7 +666,7 @@ TEST_F(DexLayoutTest, UnknownTypeDebugInfo) { std::vector<std::string> dexlayout_args = { "-o", "/dev/null", temp_dex.GetFilename() }; ASSERT_TRUE(DexLayoutExec(&temp_dex, kUnknownTypeDebugInfoInputDex, - nullptr /* profile_file */, + /* profile_file= */ nullptr, dexlayout_args)); } @@ -675,7 +675,7 @@ TEST_F(DexLayoutTest, DuplicateCodeItem) { std::vector<std::string> dexlayout_args = { "-o", "/dev/null", temp_dex.GetFilename() }; ASSERT_TRUE(DexLayoutExec(&temp_dex, kDuplicateCodeItemInputDex, - nullptr /* profile_file */, + /* profile_file= */ nullptr, dexlayout_args)); } @@ -734,7 +734,7 @@ TEST_F(DexLayoutTest, CodeItemOverrun) { }; // -v makes sure that the layout did not corrupt the dex file. ASSERT_TRUE(DexLayoutExec(&temp_dex, - /*dex_filename*/ nullptr, + /*dex_filename=*/ nullptr, &profile_file, dexlayout_args)); ASSERT_TRUE(UnlinkFile(temp_dex.GetFilename() + ".new")); @@ -772,7 +772,7 @@ TEST_F(DexLayoutTest, LinkData) { }; // -v makes sure that the layout did not corrupt the dex file. ASSERT_TRUE(DexLayoutExec(&temp_dex, - /*dex_filename*/ nullptr, + /*dex_filename=*/ nullptr, &profile_file, dexlayout_args)); ASSERT_TRUE(UnlinkFile(temp_dex.GetFilename() + ".new")); @@ -785,8 +785,8 @@ TEST_F(DexLayoutTest, ClassFilter) { const std::string input_jar = GetTestDexFileName("ManyMethods"); CHECK(dex_file_loader.Open(input_jar.c_str(), input_jar.c_str(), - /*verify*/ true, - /*verify_checksum*/ true, + /*verify=*/ true, + /*verify_checksum=*/ true, &error_msg, &dex_files)) << error_msg; ASSERT_EQ(dex_files.size(), 1u); @@ -800,14 +800,14 @@ TEST_F(DexLayoutTest, ClassFilter) { // Filter out all the classes other than the one below based on class descriptor. options.class_filter_.insert("LManyMethods$Strings;"); DexLayout dexlayout(options, - /*info*/ nullptr, - /*out_file*/ nullptr, - /*header*/ nullptr); + /*info=*/ nullptr, + /*out_file=*/ nullptr, + /*header=*/ nullptr); std::unique_ptr<DexContainer> out; bool result = dexlayout.ProcessDexFile( dex_file->GetLocation().c_str(), dex_file.get(), - /*dex_file_index*/ 0, + /*dex_file_index=*/ 0, &out, &error_msg); ASSERT_TRUE(result) << "Failed to run dexlayout " << error_msg; @@ -818,10 +818,10 @@ TEST_F(DexLayoutTest, ClassFilter) { out->GetDataSection()->Begin(), out->GetDataSection()->Size(), dex_file->GetLocation().c_str(), - /* checksum */ 0, - /*oat_dex_file*/ nullptr, - /* verify */ true, - /*verify_checksum*/ false, + /* location_checksum= */ 0, + /*oat_dex_file=*/ nullptr, + /* verify= */ true, + /*verify_checksum=*/ false, &error_msg)); ASSERT_TRUE(output_dex_file != nullptr); diff --git a/dexlist/dexlist.cc b/dexlist/dexlist.cc index 067daa7842..adb6a54d8a 100644 --- a/dexlist/dexlist.cc +++ b/dexlist/dexlist.cc @@ -172,7 +172,7 @@ static int processFile(const char* fileName) { if (!dex_file_loader.OpenAll(reinterpret_cast<const uint8_t*>(content.data()), content.size(), fileName, - /*verify*/ true, + /*verify=*/ true, kVerifyChecksum, &error_code, &error_msg, diff --git a/dexoptanalyzer/dexoptanalyzer.cc b/dexoptanalyzer/dexoptanalyzer.cc index 10bb673d14..21cdcf1313 100644 --- a/dexoptanalyzer/dexoptanalyzer.cc +++ b/dexoptanalyzer/dexoptanalyzer.cc @@ -251,8 +251,8 @@ class DexoptAnalyzer final { std::unique_ptr<OatFileAssistant> oat_file_assistant; oat_file_assistant = std::make_unique<OatFileAssistant>(dex_file_.c_str(), isa_, - false /*load_executable*/, - false /*only_load_system_executable*/, + /*load_executable=*/ false, + /*only_load_system_executable=*/ false, vdex_fd_, oat_fd_, zip_fd_); diff --git a/dexoptanalyzer/dexoptanalyzer_test.cc b/dexoptanalyzer/dexoptanalyzer_test.cc index 93ebf2b810..fe29fa109d 100644 --- a/dexoptanalyzer/dexoptanalyzer_test.cc +++ b/dexoptanalyzer/dexoptanalyzer_test.cc @@ -73,7 +73,7 @@ class DexoptAnalyzerTest : public DexoptTest { bool downgrade = false) { int dexoptanalyzerResult = Analyze(dex_file, compiler_filter, assume_profile_changed); dexoptanalyzerResult = DexoptanalyzerToOatFileAssistant(dexoptanalyzerResult); - OatFileAssistant oat_file_assistant(dex_file.c_str(), kRuntimeISA, /*load_executable*/ false); + OatFileAssistant oat_file_assistant(dex_file.c_str(), kRuntimeISA, /*load_executable=*/ false); int assistantResult = oat_file_assistant.GetDexOptNeeded( compiler_filter, assume_profile_changed, downgrade); EXPECT_EQ(assistantResult, dexoptanalyzerResult); @@ -175,7 +175,7 @@ TEST_F(DexoptAnalyzerTest, OatImageOutOfDate) { Copy(GetDexSrc1(), dex_location); GenerateOatForTest(dex_location.c_str(), CompilerFilter::kSpeed, - /*with_alternate_image*/true); + /*with_alternate_image=*/true); Verify(dex_location, CompilerFilter::kExtract); Verify(dex_location, CompilerFilter::kQuicken); @@ -192,7 +192,7 @@ TEST_F(DexoptAnalyzerTest, OatVerifyAtRuntimeImageOutOfDate) { Copy(GetDexSrc1(), dex_location); GenerateOatForTest(dex_location.c_str(), CompilerFilter::kExtract, - /*with_alternate_image*/true); + /*with_alternate_image=*/true); Verify(dex_location, CompilerFilter::kExtract); Verify(dex_location, CompilerFilter::kQuicken); diff --git a/disassembler/disassembler.cc b/disassembler/disassembler.cc index 2ed41c860a..262e8152fb 100644 --- a/disassembler/disassembler.cc +++ b/disassembler/disassembler.cc @@ -41,9 +41,9 @@ Disassembler* Disassembler::Create(InstructionSet instruction_set, DisassemblerO } else if (instruction_set == InstructionSet::kArm64) { return new arm64::DisassemblerArm64(options); } else if (instruction_set == InstructionSet::kMips) { - return new mips::DisassemblerMips(options, /* is_o32_abi */ true); + return new mips::DisassemblerMips(options, /* is_o32_abi= */ true); } else if (instruction_set == InstructionSet::kMips64) { - return new mips::DisassemblerMips(options, /* is_o32_abi */ false); + return new mips::DisassemblerMips(options, /* is_o32_abi= */ false); } else if (instruction_set == InstructionSet::kX86) { return new x86::DisassemblerX86(options, false); } else if (instruction_set == InstructionSet::kX86_64) { diff --git a/imgdiag/imgdiag.cc b/imgdiag/imgdiag.cc index 245a15b236..a1edd0047f 100644 --- a/imgdiag/imgdiag.cc +++ b/imgdiag/imgdiag.cc @@ -1007,7 +1007,7 @@ class RegionData : public RegionSpecializedBase<T> { begin_image_ptr, RegionCommon<T>::remote_contents_, base_ptr, - /*log_dirty_objects*/true); + /*log_dirty_objects=*/true); // Print shared dirty after since it's less important. if (RegionCommon<T>::GetZygoteDirtyEntryCount() != 0) { // We only reach this point if both pids were specified. Furthermore, @@ -1019,7 +1019,7 @@ class RegionData : public RegionSpecializedBase<T> { begin_image_ptr, RegionCommon<T>::zygote_contents_, begin_image_ptr, - /*log_dirty_objects*/false); + /*log_dirty_objects=*/false); } RegionSpecializedBase<T>::DumpDirtyObjects(); RegionSpecializedBase<T>::DumpDirtyEntries(); diff --git a/libartbase/base/unix_file/fd_file.h b/libartbase/base/unix_file/fd_file.h index 54a16a28b6..f5aa2a5b8b 100644 --- a/libartbase/base/unix_file/fd_file.h +++ b/libartbase/base/unix_file/fd_file.h @@ -37,13 +37,13 @@ class FdFile : public RandomAccessFile { FdFile() = default; // Creates an FdFile using the given file descriptor. // Takes ownership of the file descriptor. - FdFile(int fd, bool checkUsage); - FdFile(int fd, const std::string& path, bool checkUsage); - FdFile(int fd, const std::string& path, bool checkUsage, bool read_only_mode); + FdFile(int fd, bool check_usage); + FdFile(int fd, const std::string& path, bool check_usage); + FdFile(int fd, const std::string& path, bool check_usage, bool read_only_mode); - FdFile(const std::string& path, int flags, bool checkUsage) - : FdFile(path, flags, 0640, checkUsage) {} - FdFile(const std::string& path, int flags, mode_t mode, bool checkUsage); + FdFile(const std::string& path, int flags, bool check_usage) + : FdFile(path, flags, 0640, check_usage) {} + FdFile(const std::string& path, int flags, mode_t mode, bool check_usage); // Move constructor. FdFile(FdFile&& other) noexcept; diff --git a/libdexfile/dex/type_reference.h b/libdexfile/dex/type_reference.h index 9e7b8805af..3207e32510 100644 --- a/libdexfile/dex/type_reference.h +++ b/libdexfile/dex/type_reference.h @@ -31,8 +31,8 @@ class DexFile; // A type is located by its DexFile and the string_ids_ table index into that DexFile. class TypeReference : public DexFileReference { public: - TypeReference(const DexFile* file, dex::TypeIndex index) - : DexFileReference(file, index.index_) {} + TypeReference(const DexFile* dex_file, dex::TypeIndex index) + : DexFileReference(dex_file, index.index_) {} dex::TypeIndex TypeIndex() const { return dex::TypeIndex(index); diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index d30ec3157d..6f70efcff6 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -224,7 +224,7 @@ class OatSymbolizer final { debug::WriteDebugInfo(builder_.get(), debug_info, dwarf::DW_DEBUG_FRAME_FORMAT, - true /* write_oat_patches */); + /* write_oat_patches= */ true); builder_->End(); @@ -401,7 +401,7 @@ class OatDumper { options_.absolute_addresses_, oat_file.Begin(), oat_file.End(), - true /* can_read_literals_ */, + /* can_read_literals_= */ true, Is64BitInstructionSet(instruction_set_) ? &Thread::DumpThreadOffset<PointerSize::k64> : &Thread::DumpThreadOffset<PointerSize::k32>))) { @@ -640,7 +640,7 @@ class OatDumper { Options options; options.compact_dex_level_ = CompactDexLevel::kCompactDexLevelNone; options.update_checksum_ = true; - DexLayout dex_layout(options, /*info*/ nullptr, /*out_file*/ nullptr, /*header*/ nullptr); + DexLayout dex_layout(options, /*info=*/ nullptr, /*out_file=*/ nullptr, /*header=*/ nullptr); std::unique_ptr<art::DexContainer> dex_container; bool result = dex_layout.ProcessDexFile(vdex_dex_file->GetLocation().c_str(), vdex_dex_file.get(), @@ -661,9 +661,9 @@ class OatDumper { main_section->Size(), vdex_dex_file->GetLocation(), vdex_file->GetLocationChecksum(i), - nullptr /*oat_dex_file*/, - false /*verify*/, - true /*verify_checksum*/, + /*oat_dex_file=*/ nullptr, + /*verify=*/ false, + /*verify_checksum=*/ true, &error_msg)); if (dex == nullptr) { os << "Failed to load DexFile from layout container: " + error_msg; @@ -676,12 +676,12 @@ class OatDumper { break; } - if (!ExportDexFile(os, *oat_dex_file, dex.get(), true /*used_dexlayout*/)) { + if (!ExportDexFile(os, *oat_dex_file, dex.get(), /*used_dexlayout=*/ true)) { success = false; break; } } else { - if (!ExportDexFile(os, *oat_dex_file, vdex_dex_file.get(), false /*used_dexlayout*/)) { + if (!ExportDexFile(os, *oat_dex_file, vdex_dex_file.get(), /*used_dexlayout=*/ false)) { success = false; break; } @@ -764,8 +764,8 @@ class OatDumper { PROT_READ | PROT_WRITE, MAP_PRIVATE, file->Fd(), - /* start offset */ 0, - /* low_4gb */ false, + /* start offset= */ 0, + /* low_4gb= */ false, vdex_filename.c_str(), error_msg); if (!mmap.IsValid()) { @@ -786,7 +786,7 @@ class OatDumper { } vdex_file->Unquicken(MakeNonOwningPointerVector(tmp_dex_files), - /* decompile_return_instruction */ true); + /* decompile_return_instruction= */ true); *dex_files = std::move(tmp_dex_files); return vdex_file; @@ -1514,7 +1514,7 @@ class OatDumper { } return verifier::MethodVerifier::VerifyMethodAndDump( soa.Self(), vios, dex_method_idx, dex_file, dex_cache, *options_.class_loader_, - class_def, code_item, method, method_access_flags, /* api_level */ 0); + class_def, code_item, method, method_access_flags, /* api_level= */ 0); } return nullptr; @@ -1862,14 +1862,14 @@ class ImageDumper { oat_file = runtime->GetOatFileManager().FindOpenedOatFileFromOatLocation(oat_location); } if (oat_file == nullptr) { - oat_file = OatFile::Open(/* zip_fd */ -1, + oat_file = OatFile::Open(/* zip_fd= */ -1, oat_location, oat_location, - /* requested_base */ nullptr, - /* executable */ false, - /* low_4gb */ false, - /* abs_dex_location */ nullptr, - /* reservation */ nullptr, + /* requested_base= */ nullptr, + /* executable= */ false, + /* low_4gb= */ false, + /* abs_dex_location= */ nullptr, + /* reservation= */ nullptr, &error_msg); } if (oat_file == nullptr) { @@ -2760,14 +2760,14 @@ static int DumpImages(Runtime* runtime, OatDumperOptions* options, std::ostream* // We need to map the oat file in the low 4gb or else the fixup wont be able to fit oat file // pointers into 32 bit pointer sized ArtMethods. std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1, options->app_oat_, options->app_oat_, - /* requested_base */ nullptr, - /* executable */ false, - /* low_4gb */ true, - /* abs_dex_location */ nullptr, - /* reservation */ nullptr, + /* requested_base= */ nullptr, + /* executable= */ false, + /* low_4gb= */ true, + /* abs_dex_location= */ nullptr, + /* reservation= */ nullptr, &error_msg)); if (oat_file == nullptr) { LOG(ERROR) << "Failed to open oat file " << options->app_oat_ << " with error " << error_msg; @@ -2884,14 +2884,14 @@ static int DumpOat(Runtime* runtime, << "oatdump might fail if the oat file does not contain the dex code."; } std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1, oat_filename, oat_filename, - /* requested_base */ nullptr, - /* executable */ false, - /* low_4gb */ false, + /* requested_base= */ nullptr, + /* executable= */ false, + /* low_4gb= */ false, dex_filename, - /* reservation */ nullptr, + /* reservation= */ nullptr, &error_msg)); if (oat_file == nullptr) { LOG(ERROR) << "Failed to open oat file from '" << oat_filename << "': " << error_msg; @@ -2910,14 +2910,14 @@ static int SymbolizeOat(const char* oat_filename, std::string& output_name, bool no_bits) { std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1, oat_filename, oat_filename, - /* requested_base */ nullptr, - /* executable */ false, - /* low_4gb */ false, + /* requested_base= */ nullptr, + /* executable= */ false, + /* low_4gb= */ false, dex_filename, - /* reservation */ nullptr, + /* reservation= */ nullptr, &error_msg)); if (oat_file == nullptr) { LOG(ERROR) << "Failed to open oat file from '" << oat_filename << "': " << error_msg; @@ -2958,14 +2958,14 @@ class IMTDumper { if (oat_filename != nullptr) { std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1, oat_filename, oat_filename, - /* requested_base */ nullptr, - /* executable */ false, - /*low_4gb*/false, + /* requested_base= */ nullptr, + /* executable= */ false, + /*low_4gb=*/false, dex_filename, - /* reservation */ nullptr, + /* reservation= */ nullptr, &error_msg)); if (oat_file == nullptr) { LOG(ERROR) << "Failed to open oat file from '" << oat_filename << "': " << error_msg; diff --git a/oatdump/oatdump_test.cc b/oatdump/oatdump_test.cc index bcba18208b..e6936f65e1 100644 --- a/oatdump/oatdump_test.cc +++ b/oatdump/oatdump_test.cc @@ -93,8 +93,8 @@ TEST_F(OatDumpTest, TestExportDex) { ASSERT_TRUE(Exec(kDynamic, kModeOat, {"--export-dex-to=" + tmp_dir_}, kListOnly)); const std::string dex_location = tmp_dir_+ "/core-oj-hostdex.jar_export.dex"; const std::string dexdump2 = GetExecutableFilePath("dexdump2", - /*is_debug*/false, - /*is_static*/false); + /*is_debug=*/false, + /*is_static=*/false); std::string output; auto post_fork_fn = []() { return true; }; ForkAndExecResult res = ForkAndExec({dexdump2, "-d", dex_location}, post_fork_fn, &output); diff --git a/profman/boot_image_profile.cc b/profman/boot_image_profile.cc index 6715680361..4d8eef9cb0 100644 --- a/profman/boot_image_profile.cc +++ b/profman/boot_image_profile.cc @@ -38,7 +38,7 @@ void GenerateBootImageProfile( // Avoid merging classes since we may want to only add classes that fit a certain criteria. // If we merged the classes, every single class in each profile would be in the out_profile, // but we want to only included classes that are in at least a few profiles. - out_profile->MergeWith(*profile, /*merge_classes*/ false); + out_profile->MergeWith(*profile, /*merge_classes=*/ false); } // Image classes that were added because they are commonly used. @@ -96,7 +96,7 @@ void GenerateBootImageProfile( is_clean = false; } }, - /*instance_fields*/ VoidFunctor(), + /*instance_field_visitor=*/ VoidFunctor(), method_visitor, method_visitor); diff --git a/profman/profile_assistant.cc b/profman/profile_assistant.cc index b509fb4027..4dc5262608 100644 --- a/profman/profile_assistant.cc +++ b/profman/profile_assistant.cc @@ -37,7 +37,7 @@ ProfileAssistant::ProcessingResult ProfileAssistant::ProcessProfilesInternal( ProfileCompilationInfo info; // Load the reference profile. - if (!info.Load(reference_profile_file->Fd(), /*merge_classes*/ true, filter_fn)) { + if (!info.Load(reference_profile_file->Fd(), /*merge_classes=*/ true, filter_fn)) { LOG(WARNING) << "Could not load reference profile file"; return kErrorBadProfiles; } @@ -49,7 +49,7 @@ ProfileAssistant::ProcessingResult ProfileAssistant::ProcessProfilesInternal( // Merge all current profiles. for (size_t i = 0; i < profile_files.size(); i++) { ProfileCompilationInfo cur_info; - if (!cur_info.Load(profile_files[i]->Fd(), /*merge_classes*/ true, filter_fn)) { + if (!cur_info.Load(profile_files[i]->Fd(), /*merge_classes=*/ true, filter_fn)) { LOG(WARNING) << "Could not load profile file at index " << i; return kErrorBadProfiles; } @@ -92,7 +92,7 @@ class ScopedFlockList { // Will block until all the locks are acquired. bool Init(const std::vector<std::string>& filenames, /* out */ std::string* error) { for (size_t i = 0; i < filenames.size(); i++) { - flocks_[i] = LockedFile::Open(filenames[i].c_str(), O_RDWR, /* block */ true, error); + flocks_[i] = LockedFile::Open(filenames[i].c_str(), O_RDWR, /* block= */ true, error); if (flocks_[i].get() == nullptr) { *error += " (index=" + std::to_string(i) + ")"; return false; @@ -106,7 +106,7 @@ class ScopedFlockList { for (size_t i = 0; i < fds.size(); i++) { DCHECK_GE(fds[i], 0); flocks_[i] = LockedFile::DupOf(fds[i], "profile-file", - true /* read_only_mode */, error); + /* read_only_mode= */ true, error); if (flocks_[i].get() == nullptr) { *error += " (index=" + std::to_string(i) + ")"; return false; @@ -138,7 +138,7 @@ ProfileAssistant::ProcessingResult ProfileAssistant::ProcessProfiles( // cleared after processing. ScopedFlock reference_profile_file = LockedFile::DupOf(reference_profile_file_fd, "reference-profile", - false /* read_only_mode */, + /* read_only_mode= */ false, &error); if (reference_profile_file.get() == nullptr) { LOG(WARNING) << "Could not lock reference profiled files: " << error; @@ -163,7 +163,7 @@ ProfileAssistant::ProcessingResult ProfileAssistant::ProcessProfiles( } ScopedFlock locked_reference_profile_file = LockedFile::Open( - reference_profile_file.c_str(), O_RDWR, /* block */ true, &error); + reference_profile_file.c_str(), O_RDWR, /* block= */ true, &error); if (locked_reference_profile_file.get() == nullptr) { LOG(WARNING) << "Could not lock reference profile files: " << error; return kErrorCannotLock; diff --git a/profman/profile_assistant_test.cc b/profman/profile_assistant_test.cc index f9707d3738..31dfbc03e7 100644 --- a/profman/profile_assistant_test.cc +++ b/profman/profile_assistant_test.cc @@ -720,7 +720,7 @@ TEST_F(ProfileAssistantTest, TestProfileCreationGenerateMethods) { ASSERT_TRUE(info.Load(GetFd(profile_file))); // Verify that the profile has matching methods. ScopedObjectAccess soa(Thread::Current()); - ObjPtr<mirror::Class> klass = GetClass(soa, /* class_loader */ nullptr, "Ljava/lang/Math;"); + ObjPtr<mirror::Class> klass = GetClass(soa, /* class_loader= */ nullptr, "Ljava/lang/Math;"); ASSERT_TRUE(klass != nullptr); size_t method_count = 0; for (ArtMethod& method : klass->GetMethods(kRuntimePointerSize)) { @@ -932,8 +932,8 @@ TEST_F(ProfileAssistantTest, TestProfileCreateInlineCache) { AssertInlineCaches(inline_monomorphic, expected_monomorphic, info, - /*megamorphic*/false, - /*missing_types*/false); + /*is_megamorphic=*/false, + /*is_missing_types=*/false); } { @@ -949,8 +949,8 @@ TEST_F(ProfileAssistantTest, TestProfileCreateInlineCache) { AssertInlineCaches(inline_polymorhic, expected_polymorphic, info, - /*megamorphic*/false, - /*missing_types*/false); + /*is_megamorphic=*/false, + /*is_missing_types=*/false); } { @@ -963,8 +963,8 @@ TEST_F(ProfileAssistantTest, TestProfileCreateInlineCache) { AssertInlineCaches(inline_megamorphic, expected_megamorphic, info, - /*megamorphic*/true, - /*missing_types*/false); + /*is_megamorphic=*/true, + /*is_missing_types=*/false); } { @@ -977,8 +977,8 @@ TEST_F(ProfileAssistantTest, TestProfileCreateInlineCache) { AssertInlineCaches(inline_missing_types, expected_missing_Types, info, - /*megamorphic*/false, - /*missing_types*/true); + /*is_megamorphic=*/false, + /*is_missing_types=*/true); } { @@ -1005,7 +1005,7 @@ TEST_F(ProfileAssistantTest, MergeProfilesWithDifferentDexOrder) { const uint16_t kNumberOfMethodsToEnableCompilation = 100; ProfileCompilationInfo info1; SetupProfile("p1", 1, kNumberOfMethodsToEnableCompilation, 0, profile1, &info1, - /*start_method_index*/0, /*reverse_dex_write_order*/false); + /*start_method_index=*/0, /*reverse_dex_write_order=*/false); // The reference profile info will contain the methods with indices 50-150. // When setting up the profile reverse the order in which the dex files @@ -1014,7 +1014,7 @@ TEST_F(ProfileAssistantTest, MergeProfilesWithDifferentDexOrder) { const uint16_t kNumberOfMethodsAlreadyCompiled = 100; ProfileCompilationInfo reference_info; SetupProfile("p1", 1, kNumberOfMethodsAlreadyCompiled, 0, reference_profile, - &reference_info, kNumberOfMethodsToEnableCompilation / 2, /*reverse_dex_write_order*/true); + &reference_info, kNumberOfMethodsToEnableCompilation / 2, /*reverse_dex_write_order=*/true); // We should advise compilation. ASSERT_EQ(ProfileAssistant::kCompile, @@ -1233,9 +1233,9 @@ TEST_F(ProfileAssistantTest, MergeProfilesWithFilter) { ProfileCompilationInfo info2_filter; ProfileCompilationInfo expected; - info2_filter.Load(profile1.GetFd(), /*merge_classes*/ true, filter_fn); - info2_filter.Load(profile2.GetFd(), /*merge_classes*/ true, filter_fn); - expected.Load(reference_profile.GetFd(), /*merge_classes*/ true, filter_fn); + info2_filter.Load(profile1.GetFd(), /*merge_classes=*/ true, filter_fn); + info2_filter.Load(profile2.GetFd(), /*merge_classes=*/ true, filter_fn); + expected.Load(reference_profile.GetFd(), /*merge_classes=*/ true, filter_fn); ASSERT_TRUE(expected.MergeWith(info1_filter)); ASSERT_TRUE(expected.MergeWith(info2_filter)); @@ -1260,13 +1260,13 @@ TEST_F(ProfileAssistantTest, CopyAndUpdateProfileKey) { "fake-location2", d2.GetLocationChecksum(), num_methods_to_add, - /*num_classes*/ 0, + /*number_of_classes=*/ 0, profile1, &info1, - /*start_method_index*/ 0, - /*reverse_dex_write_order*/ false, - /*number_of_methods1*/ d1.NumMethodIds(), - /*number_of_methods2*/ d2.NumMethodIds()); + /*start_method_index=*/ 0, + /*reverse_dex_write_order=*/ false, + /*number_of_methods1=*/ d1.NumMethodIds(), + /*number_of_methods2=*/ d2.NumMethodIds()); // Run profman and pass the dex file with --apk-fd. android::base::unique_fd apk_fd( diff --git a/profman/profman.cc b/profman/profman.cc index 2b5bf48036..d989c8c849 100644 --- a/profman/profman.cc +++ b/profman/profman.cc @@ -427,7 +427,7 @@ class ProfMan final { if (use_apk_fd_list) { if (dex_file_loader.OpenZip(apks_fd_[i], dex_locations_[i], - /* verify */ false, + /* verify= */ false, kVerifyChecksum, &error_msg, &dex_files_for_location)) { @@ -438,7 +438,7 @@ class ProfMan final { } else { if (dex_file_loader.Open(apk_files_[i].c_str(), dex_locations_[i], - /* verify */ false, + /* verify= */ false, kVerifyChecksum, &error_msg, &dex_files_for_location)) { @@ -574,7 +574,7 @@ class ProfMan final { if (!FdIsValid(dump_output_to_fd_)) { std::cout << dump; } else { - unix_file::FdFile out_fd(dump_output_to_fd_, false /*check_usage*/); + unix_file::FdFile out_fd(dump_output_to_fd_, /*check_usage=*/ false); if (!out_fd.WriteFully(dump.c_str(), dump.length())) { return -1; } @@ -700,7 +700,7 @@ class ProfMan final { if (!FdIsValid(dump_output_to_fd_)) { std::cout << dump; } else { - unix_file::FdFile out_fd(dump_output_to_fd_, false /*check_usage*/); + unix_file::FdFile out_fd(dump_output_to_fd_, /*check_usage=*/ false); if (!out_fd.WriteFully(dump.c_str(), dump.length())) { return -1; } @@ -924,7 +924,7 @@ class ProfMan final { flags |= ProfileCompilationInfo::MethodHotness::kFlagPostStartup; } - TypeReference class_ref(/* dex_file */ nullptr, dex::TypeIndex()); + TypeReference class_ref(/* dex_file= */ nullptr, dex::TypeIndex()); if (!FindClass(dex_files, klass, &class_ref)) { LOG(WARNING) << "Could not find class: " << klass; return false; @@ -993,7 +993,7 @@ class ProfMan final { return false; } std::vector<TypeReference> classes(inline_cache_elems.size(), - TypeReference(/* dex_file */ nullptr, dex::TypeIndex())); + TypeReference(/* dex_file= */ nullptr, dex::TypeIndex())); size_t class_it = 0; for (const std::string& ic_class : inline_cache_elems) { if (!FindClass(dex_files, ic_class, &(classes[class_it++]))) { @@ -1213,7 +1213,7 @@ class ProfMan final { // Do not clear if invalid. The input might be an archive. bool load_ok = use_fds ? profile.Load(profile_files_fd_[0]) - : profile.Load(profile_files_[0], /*clear_if_invalid*/ false); + : profile.Load(profile_files_[0], /*clear_if_invalid=*/ false); if (load_ok) { // Open the dex files to look up classes and methods. std::vector<std::unique_ptr<const DexFile>> dex_files; @@ -1223,7 +1223,7 @@ class ProfMan final { } bool result = use_fds ? profile.Save(reference_profile_file_fd_) - : profile.Save(reference_profile_file_, /*bytes_written*/ nullptr); + : profile.Save(reference_profile_file_, /*bytes_written=*/ nullptr); return result ? 0 : kErrorFailedToSaveProfile; } else { return kErrorFailedToLoadProfile; diff --git a/tools/art_verifier/art_verifier.cc b/tools/art_verifier/art_verifier.cc index 45c1a330cc..0ef6c06dff 100644 --- a/tools/art_verifier/art_verifier.cc +++ b/tools/art_verifier/art_verifier.cc @@ -46,8 +46,8 @@ bool LoadDexFile(const std::string& dex_filename, std::string error_msg; if (!dex_file_loader.Open(dex_filename.c_str(), dex_filename.c_str(), - /* verify */ true, - /* verify_checksum */ true, + /* verify= */ true, + /* verify_checksum= */ true, &error_msg, dex_files)) { LOG(ERROR) << error_msg; diff --git a/tools/dexanalyze/dexanalyze_bytecode.cc b/tools/dexanalyze/dexanalyze_bytecode.cc index 659a940e8b..88db672ad7 100644 --- a/tools/dexanalyze/dexanalyze_bytecode.cc +++ b/tools/dexanalyze/dexanalyze_bytecode.cc @@ -118,7 +118,7 @@ void NewRegisterInstructions::ProcessDexFiles( ProcessCodeItem(*dex_file, method.GetInstructionsAndData(), accessor.GetClassIdx(), - /*count_types*/ true, + /*count_types=*/ true, types); } } @@ -143,7 +143,7 @@ void NewRegisterInstructions::ProcessDexFiles( ProcessCodeItem(*dex_file, data, accessor.GetClassIdx(), - /*count_types*/ false, + /*count_types=*/ false, types); std::vector<uint8_t> buffer = std::move(buffer_); buffer_.clear(); diff --git a/tools/dexanalyze/dexanalyze_test.cc b/tools/dexanalyze/dexanalyze_test.cc index 96be3f9b8d..c6648c09db 100644 --- a/tools/dexanalyze/dexanalyze_test.cc +++ b/tools/dexanalyze/dexanalyze_test.cc @@ -37,23 +37,23 @@ class DexAnalyzeTest : public CommonRuntimeTest { }; TEST_F(DexAnalyzeTest, NoInputFileGiven) { - DexAnalyzeExec({ "-a" }, /*expect_success*/ false); + DexAnalyzeExec({ "-a" }, /*expect_success=*/ false); } TEST_F(DexAnalyzeTest, CantOpenInput) { - DexAnalyzeExec({ "-a", "/non/existent/path" }, /*expect_success*/ false); + DexAnalyzeExec({ "-a", "/non/existent/path" }, /*expect_success=*/ false); } TEST_F(DexAnalyzeTest, TestAnalyzeMultidex) { - DexAnalyzeExec({ "-a", GetTestDexFileName("MultiDex") }, /*expect_success*/ true); + DexAnalyzeExec({ "-a", GetTestDexFileName("MultiDex") }, /*expect_success=*/ true); } TEST_F(DexAnalyzeTest, TestAnalizeCoreDex) { - DexAnalyzeExec({ "-a", GetLibCoreDexFileNames()[0] }, /*expect_success*/ true); + DexAnalyzeExec({ "-a", GetLibCoreDexFileNames()[0] }, /*expect_success=*/ true); } TEST_F(DexAnalyzeTest, TestInvalidArg) { - DexAnalyzeExec({ "-invalid-option" }, /*expect_success*/ false); + DexAnalyzeExec({ "-invalid-option" }, /*expect_success=*/ false); } } // namespace art diff --git a/tools/field-null-percent/fieldnull.cc b/tools/field-null-percent/fieldnull.cc index 1bd122a1b2..8f5b389a48 100644 --- a/tools/field-null-percent/fieldnull.cc +++ b/tools/field-null-percent/fieldnull.cc @@ -167,7 +167,7 @@ static void VMInitCb(jvmtiEnv* jvmti, JNIEnv* env, jobject thr ATTRIBUTE_UNUSED) } static jint AgentStart(JavaVM* vm, char* options, bool is_onload) { - android::base::InitLogging(/* argv */nullptr); + android::base::InitLogging(/* argv= */nullptr); java_vm = vm; jvmtiEnv* jvmti = nullptr; if (SetupJvmtiEnv(vm, &jvmti) != JNI_OK) { @@ -204,14 +204,14 @@ static jint AgentStart(JavaVM* vm, char* options, bool is_onload) { extern "C" JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char* options, void* reserved ATTRIBUTE_UNUSED) { - return AgentStart(vm, options, /*is_onload*/false); + return AgentStart(vm, options, /*is_onload=*/false); } // Early attachment extern "C" JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* jvm, char* options, void* reserved ATTRIBUTE_UNUSED) { - return AgentStart(jvm, options, /*is_onload*/true); + return AgentStart(jvm, options, /*is_onload=*/true); } } // namespace fieldnull diff --git a/tools/hiddenapi/hiddenapi.cc b/tools/hiddenapi/hiddenapi.cc index 6d9b6fbe40..68211a1641 100644 --- a/tools/hiddenapi/hiddenapi.cc +++ b/tools/hiddenapi/hiddenapi.cc @@ -278,7 +278,7 @@ class ClassPath final { if (open_writable) { for (const std::string& filename : dex_paths) { - File fd(filename.c_str(), O_RDWR, /* check_usage */ false); + File fd(filename.c_str(), O_RDWR, /* check_usage= */ false); CHECK_NE(fd.Fd(), -1) << "Unable to open file '" << filename << "': " << strerror(errno); // Memory-map the dex file with MAP_SHARED flag so that changes in memory @@ -288,10 +288,10 @@ class ClassPath final { // We do those checks here and skip them when loading the processed file // into boot class path. std::unique_ptr<const DexFile> dex_file(dex_loader.OpenDex(fd.Release(), - /* location */ filename, - /* verify */ true, - /* verify_checksum */ true, - /* mmap_shared */ true, + /* location= */ filename, + /* verify= */ true, + /* verify_checksum= */ true, + /* mmap_shared= */ true, &error_msg)); CHECK(dex_file.get() != nullptr) << "Open failed for '" << filename << "' " << error_msg; CHECK(dex_file->IsStandardDexFile()) << "Expected a standard dex file '" << filename << "'"; @@ -302,9 +302,9 @@ class ClassPath final { } else { for (const std::string& filename : dex_paths) { bool success = dex_loader.Open(filename.c_str(), - /* location */ filename, - /* verify */ true, - /* verify_checksum */ true, + /* location= */ filename, + /* verify= */ true, + /* verify_checksum= */ true, &error_msg, &dex_files_); CHECK(success) << "Open failed for '" << filename << "' " << error_msg; @@ -640,7 +640,7 @@ class HiddenApi final { OpenApiFile(blacklist_path_, api_list, HiddenApiAccessFlags::kBlacklist); // Open all dex files. - ClassPath boot_classpath(boot_dex_paths_, /* open_writable */ true); + ClassPath boot_classpath(boot_dex_paths_, /* open_writable= */ true); // Set access flags of all members. boot_classpath.ForEachDexMember([&api_list](const DexMember& boot_member) { @@ -688,7 +688,7 @@ class HiddenApi final { std::set<std::string> unresolved; // Open all dex files. - ClassPath boot_classpath(boot_dex_paths_, /* open_writable */ false); + ClassPath boot_classpath(boot_dex_paths_, /* open_writable= */ false); Hierarchy boot_hierarchy(boot_classpath); // Mark all boot dex members private. @@ -698,7 +698,7 @@ class HiddenApi final { // Resolve each SDK dex member against the framework and mark it white. for (const std::vector<std::string>& stub_classpath_dex : stub_classpaths_) { - ClassPath stub_classpath(stub_classpath_dex, /* open_writable */ false); + ClassPath stub_classpath(stub_classpath_dex, /* open_writable= */ false); Hierarchy stub_hierarchy(stub_classpath); stub_classpath.ForEachDexMember( [&stub_hierarchy, &boot_hierarchy, &boot_members, &unresolved]( diff --git a/tools/hiddenapi/hiddenapi_test.cc b/tools/hiddenapi/hiddenapi_test.cc index b50f684f09..799546e07b 100644 --- a/tools/hiddenapi/hiddenapi_test.cc +++ b/tools/hiddenapi/hiddenapi_test.cc @@ -85,15 +85,15 @@ class HiddenApiTest : public CommonRuntimeTest { ArtDexFileLoader dex_loader; std::string error_msg; - File fd(file.GetFilename(), O_RDONLY, /* check_usage */ false); + File fd(file.GetFilename(), O_RDONLY, /* check_usage= */ false); if (fd.Fd() == -1) { LOG(FATAL) << "Unable to open file '" << file.GetFilename() << "': " << strerror(errno); UNREACHABLE(); } std::unique_ptr<const DexFile> dex_file(dex_loader.OpenDex( - fd.Release(), /* location */ file.GetFilename(), /* verify */ false, - /* verify_checksum */ true, /* mmap_shared */ false, &error_msg)); + fd.Release(), /* location= */ file.GetFilename(), /* verify= */ false, + /* verify_checksum= */ true, /* mmap_shared= */ false, &error_msg)); if (dex_file.get() == nullptr) { LOG(FATAL) << "Open failed for '" << file.GetFilename() << "' " << error_msg; UNREACHABLE(); @@ -179,22 +179,31 @@ class HiddenApiTest : public CommonRuntimeTest { HiddenApiAccessFlags::ApiList GetIMethodHiddenFlags(const DexFile& dex_file) { return GetMethodHiddenFlags( - "imethod", 0, /* native */ false, FindClass("LMain;", dex_file), dex_file); + "imethod", 0, /* expected_native= */ false, FindClass("LMain;", dex_file), dex_file); } HiddenApiAccessFlags::ApiList GetSMethodHiddenFlags(const DexFile& dex_file) { - return GetMethodHiddenFlags( - "smethod", kAccPublic, /* native */ false, FindClass("LMain;", dex_file), dex_file); + return GetMethodHiddenFlags("smethod", + kAccPublic, + /* expected_native= */ false, + FindClass("LMain;", dex_file), + dex_file); } HiddenApiAccessFlags::ApiList GetINMethodHiddenFlags(const DexFile& dex_file) { - return GetMethodHiddenFlags( - "inmethod", kAccPublic, /* native */ true, FindClass("LMain;", dex_file), dex_file); + return GetMethodHiddenFlags("inmethod", + kAccPublic, + /* expected_native= */ true, + FindClass("LMain;", dex_file), + dex_file); } HiddenApiAccessFlags::ApiList GetSNMethodHiddenFlags(const DexFile& dex_file) { - return GetMethodHiddenFlags( - "snmethod", kAccProtected, /* native */ true, FindClass("LMain;", dex_file), dex_file); + return GetMethodHiddenFlags("snmethod", + kAccProtected, + /* expected_native= */ true, + FindClass("LMain;", dex_file), + dex_file); } }; diff --git a/tools/jit-load/jitload.cc b/tools/jit-load/jitload.cc index d67eef01b9..7e715de2cc 100644 --- a/tools/jit-load/jitload.cc +++ b/tools/jit-load/jitload.cc @@ -90,7 +90,7 @@ JNICALL void VMDeathCb(jvmtiEnv* jvmti, JNIEnv* env ATTRIBUTE_UNUSED) { } static jvmtiEnv* SetupJvmti(JavaVM* vm, const char* options) { - android::base::InitLogging(/* argv */nullptr); + android::base::InitLogging(/* argv= */nullptr); jvmtiEnv* jvmti = nullptr; if (vm->GetEnv(reinterpret_cast<void**>(&jvmti), JVMTI_VERSION_1_0) != JNI_OK && diff --git a/tools/ti-fast/tifast.cc b/tools/ti-fast/tifast.cc index 85c433b10f..00ef6563a9 100644 --- a/tools/ti-fast/tifast.cc +++ b/tools/ti-fast/tifast.cc @@ -528,7 +528,7 @@ void LogPrinter::PrintRest(jvmtiEnv* jvmti, JNIEnv* jni, jthreadContainer thr, A template<typename ...Args> void LogPrinter::PrintRest(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, Args... args) { ScopedClassInfo sci(jvmti, klass); - if (sci.Init(/*get_generic*/event_ != JVMTI_EVENT_VM_OBJECT_ALLOC)) { + if (sci.Init(/*get_generic=*/event_ != JVMTI_EVENT_VM_OBJECT_ALLOC)) { stream << ", jclass[" << sci << "]"; } else { stream << ", jclass[TYPE UNKNOWN]"; diff --git a/tools/titrace/titrace.cc b/tools/titrace/titrace.cc index ca568d7b33..1e49c0b021 100644 --- a/tools/titrace/titrace.cc +++ b/tools/titrace/titrace.cc @@ -237,7 +237,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* jvm, void* /* reserved */) { using namespace titrace; // NOLINT [build/namespaces] [5] - android::base::InitLogging(/* argv */nullptr); + android::base::InitLogging(/* argv= */nullptr); jvmtiEnv* jvmti = nullptr; { diff --git a/tools/veridex/flow_analysis.cc b/tools/veridex/flow_analysis.cc index 69f7def329..e925e1da17 100644 --- a/tools/veridex/flow_analysis.cc +++ b/tools/veridex/flow_analysis.cc @@ -318,7 +318,7 @@ void VeriFlowAnalysis::ProcessDexInstruction(const Instruction& instruction) { case Instruction::INVOKE_STATIC: case Instruction::INVOKE_SUPER: case Instruction::INVOKE_VIRTUAL: { - last_result_ = AnalyzeInvoke(instruction, /* is_range */ false); + last_result_ = AnalyzeInvoke(instruction, /* is_range= */ false); break; } @@ -327,7 +327,7 @@ void VeriFlowAnalysis::ProcessDexInstruction(const Instruction& instruction) { case Instruction::INVOKE_STATIC_RANGE: case Instruction::INVOKE_SUPER_RANGE: case Instruction::INVOKE_VIRTUAL_RANGE: { - last_result_ = AnalyzeInvoke(instruction, /* is_range */ true); + last_result_ = AnalyzeInvoke(instruction, /* is_range= */ true); break; } @@ -702,14 +702,14 @@ RegisterValue FlowAnalysisCollector::AnalyzeInvoke(const Instruction& instructio // second parameter for the field name. RegisterValue cls = GetRegister(GetParameterAt(instruction, is_range, args, 0)); RegisterValue name = GetRegister(GetParameterAt(instruction, is_range, args, 1)); - uses_.push_back(ReflectAccessInfo(cls, name, /* is_method */ false)); + uses_.push_back(ReflectAccessInfo(cls, name, /* is_method= */ false)); return GetReturnType(id); } else if (IsGetMethod(method)) { // Class.getMethod or Class.getDeclaredMethod. Fetch the first parameter for the class, and the // second parameter for the field name. RegisterValue cls = GetRegister(GetParameterAt(instruction, is_range, args, 0)); RegisterValue name = GetRegister(GetParameterAt(instruction, is_range, args, 1)); - uses_.push_back(ReflectAccessInfo(cls, name, /* is_method */ true)); + uses_.push_back(ReflectAccessInfo(cls, name, /* is_method= */ true)); return GetReturnType(id); } else if (method == VeriClass::getClass_) { // Get the type of the first parameter. diff --git a/tools/veridex/flow_analysis.h b/tools/veridex/flow_analysis.h index 865b9df03d..2151a41725 100644 --- a/tools/veridex/flow_analysis.h +++ b/tools/veridex/flow_analysis.h @@ -174,7 +174,8 @@ struct ReflectAccessInfo { RegisterValue name; bool is_method; - ReflectAccessInfo(RegisterValue c, RegisterValue n, bool m) : cls(c), name(n), is_method(m) {} + ReflectAccessInfo(RegisterValue c, RegisterValue n, bool is_method) + : cls(c), name(n), is_method(is_method) {} bool IsConcrete() const { // We capture RegisterSource::kString for the class, for example in Class.forName. |