ART: Refactor for bugprone-argument-comment
Handles openjdkjvmti.
Bug: 116054210
Test: WITH_TIDY=1 mmma art
Change-Id: Ic73e3f32b08f3b6d9300428ad95d12a696db0458
diff --git a/openjdkjvmti/OpenjdkJvmTi.cc b/openjdkjvmti/OpenjdkJvmTi.cc
index 48f326a..4bc33b6 100644
--- a/openjdkjvmti/OpenjdkJvmTi.cc
+++ b/openjdkjvmti/OpenjdkJvmTi.cc
@@ -1195,7 +1195,7 @@
#undef ADD_CAPABILITY
gEventHandler->HandleChangedCapabilities(ArtJvmTiEnv::AsArtJvmTiEnv(env),
changed,
- /*added*/true);
+ /*added=*/true);
return ret;
}
@@ -1219,7 +1219,7 @@
#undef DEL_CAPABILITY
gEventHandler->HandleChangedCapabilities(ArtJvmTiEnv::AsArtJvmTiEnv(env),
changed,
- /*added*/false);
+ /*added=*/false);
return OK;
}
diff --git a/openjdkjvmti/deopt_manager.cc b/openjdkjvmti/deopt_manager.cc
index d20c756..8bac38a 100644
--- a/openjdkjvmti/deopt_manager.cc
+++ b/openjdkjvmti/deopt_manager.cc
@@ -289,7 +289,7 @@
uninterruptible_cause_ = critical_section_.Enter(art::gc::kGcCauseInstrumentation,
art::gc::kCollectorTypeCriticalSection);
art::Runtime::Current()->GetThreadList()->SuspendAll("JMVTI Deoptimizing methods",
- /*long_suspend*/ false);
+ /*long_suspend=*/ false);
}
~ScopedDeoptimizationContext()
diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc
index 300a009..48df53a 100644
--- a/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
@@ -517,7 +517,7 @@
self,
jnienv,
art::jni::EncodeArtMethod(method),
- /*was_popped_by_exception*/ static_cast<jboolean>(JNI_FALSE),
+ /*was_popped_by_exception=*/ static_cast<jboolean>(JNI_FALSE),
val);
}
}
@@ -545,7 +545,7 @@
self,
jnienv,
art::jni::EncodeArtMethod(method),
- /*was_popped_by_exception*/ static_cast<jboolean>(JNI_FALSE),
+ /*was_popped_by_exception=*/ static_cast<jboolean>(JNI_FALSE),
val);
}
}
@@ -572,7 +572,7 @@
self,
jnienv,
art::jni::EncodeArtMethod(method),
- /*was_popped_by_exception*/ static_cast<jboolean>(JNI_TRUE),
+ /*was_popped_by_exception=*/ static_cast<jboolean>(JNI_TRUE),
val);
// Match RI behavior of just throwing away original exception if a new one is thrown.
if (LIKELY(!self->IsExceptionPending())) {
@@ -777,7 +777,7 @@
context.get(),
/*out*/ out_method,
/*out*/ dex_pc);
- clf.WalkStack(/* include_transitions */ false);
+ clf.WalkStack(/* include_transitions= */ false);
}
// Call-back when an exception is thrown.
@@ -793,8 +793,8 @@
FindCatchMethodsFromThrow(self, exception_object, &catch_method, &catch_pc);
uint32_t dex_pc = 0;
art::ArtMethod* method = self->GetCurrentMethod(&dex_pc,
- /* check_suspended */ true,
- /* abort_on_error */ art::kIsDebugBuild);
+ /* check_suspended= */ true,
+ /* abort_on_error= */ art::kIsDebugBuild);
ScopedLocalRef<jobject> exception(jnienv,
AddLocalRef<jobject>(jnienv, exception_object.Get()));
RunEventCallback<ArtJvmtiEvent::kException>(
@@ -819,8 +819,8 @@
art::JNIEnvExt* jnienv = self->GetJniEnv();
uint32_t dex_pc;
art::ArtMethod* method = self->GetCurrentMethod(&dex_pc,
- /* check_suspended */ true,
- /* abort_on_error */ art::kIsDebugBuild);
+ /* check_suspended= */ true,
+ /* abort_on_error= */ art::kIsDebugBuild);
ScopedLocalRef<jobject> exception(jnienv,
AddLocalRef<jobject>(jnienv, exception_object.Get()));
RunEventCallback<ArtJvmtiEvent::kExceptionCatch>(
diff --git a/openjdkjvmti/fixed_up_dex_file.cc b/openjdkjvmti/fixed_up_dex_file.cc
index aedec27..6745d91 100644
--- a/openjdkjvmti/fixed_up_dex_file.cc
+++ b/openjdkjvmti/fixed_up_dex_file.cc
@@ -67,7 +67,9 @@
const art::DexFile& original_dex_file) {
const art::VdexFile* vdex = GetVdex(original_dex_file);
if (vdex != nullptr) {
- vdex->UnquickenDexFile(new_dex_file, original_dex_file, /* decompile_return_instruction */true);
+ vdex->UnquickenDexFile(new_dex_file,
+ original_dex_file,
+ /* decompile_return_instruction= */ true);
}
new_dex_file.UnhideApis();
}
@@ -79,7 +81,7 @@
dex.Begin(),
dex.Size(),
"FixedUpDexFile_Verification.dex",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error)) {
LOG(FATAL) << "Failed to verify de-quickened dex file: " << error;
}
@@ -113,9 +115,9 @@
options.class_filter_.insert(descriptor);
}
art::DexLayout dex_layout(options,
- /*info*/ nullptr,
- /*out_file*/ nullptr,
- /*header*/ nullptr);
+ /*info=*/ nullptr,
+ /*out_file=*/ nullptr,
+ /*header=*/ nullptr);
std::unique_ptr<art::DexContainer> dex_container;
bool result = dex_layout.ProcessDexFile(
original.GetLocation().c_str(),
@@ -136,11 +138,11 @@
new_dex_file = dex_file_loader.Open(
data.data(),
data.size(),
- /*location*/"Unquickening_dexfile.dex",
- /*location_checksum*/0,
- /*oat_dex_file*/nullptr,
- /*verify*/false,
- /*verify_checksum*/false,
+ /*location=*/"Unquickening_dexfile.dex",
+ /*location_checksum=*/0,
+ /*oat_dex_file=*/nullptr,
+ /*verify=*/false,
+ /*verify_checksum=*/false,
&error);
if (new_dex_file == nullptr) {
diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index f6113df..3d33487 100644
--- a/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
@@ -113,8 +113,8 @@
std::unique_ptr<const art::DexFile> dex_file(dex_file_loader.Open(map_name,
checksum,
std::move(map),
- /*verify*/true,
- /*verify_checksum*/true,
+ /*verify=*/true,
+ /*verify_checksum=*/true,
&error_msg));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Unable to load modified dex file for " << descriptor << ": " << error_msg;
diff --git a/openjdkjvmti/ti_class_definition.cc b/openjdkjvmti/ti_class_definition.cc
index 895e734..9e8288f 100644
--- a/openjdkjvmti/ti_class_definition.cc
+++ b/openjdkjvmti/ti_class_definition.cc
@@ -246,17 +246,17 @@
mmap_name += name_;
std::string error;
dex_data_mmap_ = art::MemMap::MapAnonymous(mmap_name.c_str(),
- /* addr */ nullptr,
+ /* addr= */ nullptr,
dequick_size,
PROT_NONE,
- /*low_4gb*/ false,
+ /*low_4gb=*/ false,
&error);
mmap_name += "-TEMP";
temp_mmap_ = art::MemMap::MapAnonymous(mmap_name.c_str(),
- /* addr */ nullptr,
+ /* addr= */ nullptr,
dequick_size,
PROT_READ | PROT_WRITE,
- /*low_4gb*/ false,
+ /*low_4gb=*/ false,
&error);
if (UNLIKELY(dex_data_mmap_.IsValid() && temp_mmap_.IsValid())) {
// Need to save the initial dexfile so we don't need to search for it in the fault-handler.
diff --git a/openjdkjvmti/ti_extension.cc b/openjdkjvmti/ti_extension.cc
index c61d6e5..c628a32 100644
--- a/openjdkjvmti/ti_extension.cc
+++ b/openjdkjvmti/ti_extension.cc
@@ -424,7 +424,7 @@
}
}
return event_handler->SetEvent(art_env,
- /*event_thread*/nullptr,
+ /*thread=*/nullptr,
static_cast<ArtJvmtiEvent>(extension_event_index),
mode);
}
diff --git a/openjdkjvmti/ti_heap.cc b/openjdkjvmti/ti_heap.cc
index 6c79a60..559ee0d 100644
--- a/openjdkjvmti/ti_heap.cc
+++ b/openjdkjvmti/ti_heap.cc
@@ -981,7 +981,9 @@
// TODO: We don't have this info.
if (thread != nullptr) {
ref_info->jni_local.depth = 0;
- art::ArtMethod* method = thread->GetCurrentMethod(nullptr, false /* abort_on_error */);
+ art::ArtMethod* method = thread->GetCurrentMethod(nullptr,
+ /* check_suspended= */ true,
+ /* abort_on_error= */ false);
if (method != nullptr) {
ref_info->jni_local.method = art::jni::EncodeArtMethod(method);
}
@@ -1012,7 +1014,7 @@
ref_info->stack_local.slot = static_cast<jint>(java_info.GetVReg());
const art::StackVisitor* visitor = java_info.GetVisitor();
ref_info->stack_local.location =
- static_cast<jlocation>(visitor->GetDexPc(false /* abort_on_failure */));
+ static_cast<jlocation>(visitor->GetDexPc(/* abort_on_failure= */ false));
ref_info->stack_local.depth = static_cast<jint>(visitor->GetFrameDepth());
art::ArtMethod* method = visitor->GetMethod();
if (method != nullptr) {
@@ -1447,7 +1449,7 @@
}
jvmtiError HeapUtil::ForceGarbageCollection(jvmtiEnv* env ATTRIBUTE_UNUSED) {
- art::Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
+ art::Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references= */ false);
return ERR(NONE);
}
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index 2958941..7d69c89 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -547,7 +547,7 @@
return;
}
bool needs_instrument = !visitor.IsShadowFrame();
- uint32_t pc = visitor.GetDexPc(/*abort_on_failure*/ false);
+ uint32_t pc = visitor.GetDexPc(/*abort_on_failure=*/ false);
if (pc == art::dex::kDexNoIndex) {
// Cannot figure out current PC.
result_ = ERR(OPAQUE_FRAME);
diff --git a/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc
index f71328a..aac7233 100644
--- a/openjdkjvmti/ti_monitor.cc
+++ b/openjdkjvmti/ti_monitor.cc
@@ -191,7 +191,7 @@
// Reaquire the mutex/monitor, also go to sleep if we were suspended.
// TODO Give an extension to wait without suspension as well.
- MonitorEnter(self, /*suspend*/ true);
+ MonitorEnter(self, /*suspend=*/ true);
CHECK(owner_.load(std::memory_order_relaxed) == self);
DCHECK_EQ(1u, count_);
// Reset the count.
@@ -261,7 +261,7 @@
JvmtiMonitor* monitor = DecodeMonitor(id);
art::Thread* self = art::Thread::Current();
- monitor->MonitorEnter(self, /*suspend*/false);
+ monitor->MonitorEnter(self, /*suspend=*/false);
return ERR(NONE);
}
@@ -274,7 +274,7 @@
JvmtiMonitor* monitor = DecodeMonitor(id);
art::Thread* self = art::Thread::Current();
- monitor->MonitorEnter(self, /*suspend*/true);
+ monitor->MonitorEnter(self, /*suspend=*/true);
return ERR(NONE);
}
diff --git a/openjdkjvmti/ti_object.cc b/openjdkjvmti/ti_object.cc
index 89ce352..344ae88 100644
--- a/openjdkjvmti/ti_object.cc
+++ b/openjdkjvmti/ti_object.cc
@@ -92,7 +92,7 @@
{
art::ScopedObjectAccess soa(self); // Now we know we have the shared lock.
art::ScopedThreadSuspension sts(self, art::kNative);
- art::ScopedSuspendAll ssa("GetObjectMonitorUsage", /*long_suspend*/false);
+ art::ScopedSuspendAll ssa("GetObjectMonitorUsage", /*long_suspend=*/false);
art::ObjPtr<art::mirror::Object> target(self->DecodeJObject(obj));
// This gets the list of threads trying to lock or wait on the monitor.
art::MonitorInfo info(target.Ptr());
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index db2b143..a908ef0 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -152,7 +152,7 @@
const std::unordered_set<art::ArtMethod*>& obsoleted_methods,
ObsoleteMap* obsolete_maps)
: StackVisitor(thread,
- /*context*/nullptr,
+ /*context=*/nullptr,
StackVisitor::StackWalkKind::kIncludeInlinedFrames),
allocator_(allocator),
obsoleted_methods_(obsoleted_methods),
@@ -305,10 +305,10 @@
std::string* error_msg) {
art::MemMap map = art::MemMap::MapAnonymous(
StringPrintf("%s-transformed", original_location.c_str()).c_str(),
- /* addr */ nullptr,
+ /* addr= */ nullptr,
data.size(),
PROT_READ|PROT_WRITE,
- /*low_4gb*/ false,
+ /*low_4gb=*/ false,
error_msg);
if (LIKELY(map.IsValid())) {
memcpy(map.Begin(), data.data(), data.size());
@@ -445,8 +445,8 @@
std::unique_ptr<const art::DexFile> dex_file(dex_file_loader.Open(name,
checksum,
std::move(map),
- /*verify*/true,
- /*verify_checksum*/true,
+ /*verify=*/true,
+ /*verify_checksum=*/true,
error_msg_));
if (dex_file.get() == nullptr) {
os << "Unable to load modified dex file for " << def.GetName() << ": " << *error_msg_;
@@ -1117,10 +1117,10 @@
dex_file_.get(),
hs.NewHandle(iter.GetNewDexCache()),
hs.NewHandle(GetClassLoader()),
- dex_file_->GetClassDef(0), /*class_def*/
- nullptr, /*compiler_callbacks*/
- true, /*allow_soft_failures*/
- /*log_level*/
+ /*class_def=*/ dex_file_->GetClassDef(0),
+ /*callbacks=*/ nullptr,
+ /*allow_soft_failures=*/ true,
+ /*log_level=*/
art::verifier::HardFailLogMode::kLogWarning,
art::Runtime::Current()->GetTargetSdkVersion(),
&error);
@@ -1367,7 +1367,7 @@
// TODO We might want to give this its own suspended state!
// TODO This isn't right. We need to change state without any chance of suspend ideally!
art::ScopedThreadSuspension sts(self_, art::ThreadState::kNative);
- art::ScopedSuspendAll ssa("Final installation of redefined Classes!", /*long_suspend*/true);
+ art::ScopedSuspendAll ssa("Final installation of redefined Classes!", /*long_suspend=*/true);
for (RedefinitionDataIter data = holder.begin(); data != holder.end(); ++data) {
art::ScopedAssertNoThreadSuspension nts("Updating runtime objects for redefinition");
ClassRedefinition& redef = data.GetRedefinition();
diff --git a/openjdkjvmti/ti_search.cc b/openjdkjvmti/ti_search.cc
index 1189b1d..427869e 100644
--- a/openjdkjvmti/ti_search.cc
+++ b/openjdkjvmti/ti_search.cc
@@ -229,8 +229,12 @@
std::string error_msg;
std::vector<std::unique_ptr<const art::DexFile>> dex_files;
const art::ArtDexFileLoader dex_file_loader;
- if (!dex_file_loader.Open(
- segment, segment, /* verify */ true, /* verify_checksum */ true, &error_msg, &dex_files)) {
+ if (!dex_file_loader.Open(segment,
+ segment,
+ /* verify= */ true,
+ /* verify_checksum= */ true,
+ &error_msg,
+ &dex_files)) {
LOG(WARNING) << "Could not open " << segment << " for boot classpath extension: " << error_msg;
return ERR(ILLEGAL_ARGUMENT);
}
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index 5a98755..1279f3b 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -150,7 +150,7 @@
frames.push_back(info);
};
auto visitor = MakeStackTraceVisitor(self, start_input, stop_input, frames_fn);
- visitor.WalkStack(/* include_transitions */ false);
+ visitor.WalkStack(/* include_transitions= */ false);
start_result = visitor.start;
stop_result = visitor.stop;
@@ -218,7 +218,7 @@
++index;
};
auto visitor = MakeStackTraceVisitor(self, start_input, stop_input, frames_fn);
- visitor.WalkStack(/* include_transitions */ false);
+ visitor.WalkStack(/* include_transitions= */ false);
}
jvmtiFrameInfo* frame_buffer;
@@ -330,7 +330,7 @@
thread_frames->push_back(info);
};
auto visitor = MakeStackTraceVisitor(thread, 0u, stop_input, frames_fn);
- visitor.WalkStack(/* include_transitions */ false);
+ visitor.WalkStack(/* include_transitions= */ false);
}
art::Barrier barrier;
@@ -910,7 +910,7 @@
art::Locks::mutator_lock_->AssertSharedHeld(art::Thread::Current());
// Find the monitors on the stack.
MonitorVisitor visitor(target);
- visitor.WalkStack(/* include_transitions */ false);
+ visitor.WalkStack(/* include_transitions= */ false);
// Find any other monitors, including ones acquired in native code.
art::RootInfo root_info(art::kRootVMInternal);
target->GetJniEnv()->VisitMonitorRoots(&visitor, root_info);
diff --git a/openjdkjvmti/ti_thread.cc b/openjdkjvmti/ti_thread.cc
index a0e5b5c..12b9546 100644
--- a/openjdkjvmti/ti_thread.cc
+++ b/openjdkjvmti/ti_thread.cc
@@ -857,7 +857,7 @@
bool timeout = true;
art::Thread* ret_target = art::Runtime::Current()->GetThreadList()->SuspendThreadByPeer(
target_jthread,
- /* request_suspension */ true,
+ /* request_suspension= */ true,
art::SuspendReason::kForUserCode,
&timeout);
if (ret_target == nullptr && !timeout) {
diff --git a/openjdkjvmti/transform.cc b/openjdkjvmti/transform.cc
index d87ca56..653f944 100644
--- a/openjdkjvmti/transform.cc
+++ b/openjdkjvmti/transform.cc
@@ -76,7 +76,7 @@
art::LockLevel::kSignalHandlingLock),
class_definition_initialized_cond_("JVMTI Initialized class definitions condition",
uninitialized_class_definitions_lock_) {
- manager->AddHandler(this, /* generated_code */ false);
+ manager->AddHandler(this, /* generated_code= */ false);
}
~TransformationFaultHandler() {