Fix performance-unnecessary-value-param clang-tidy issues

Test: m tidy-art
Bug: 213953102
Change-Id: Ibe16d59559d96e0a4562ecd2af1dffa28bafc068
diff --git a/build/Android.bp b/build/Android.bp
index 6b13309..930a9c7 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -36,6 +36,7 @@
     "modernize-use-bool-literals",
     "performance-implicit-conversion-in-loop",
     "performance-unnecessary-copy-initialization",
+    "performance-unnecessary-value-param",
 ]
 
 art_clang_tidy_allowed = [
@@ -50,7 +51,6 @@
     "performance-faster-string-find",
     "performance-for-range-copy",
     "performance-noexcept-move-constructor",
-    "performance-unnecessary-value-param",
 ]
 
 art_clang_tidy_disabled = [
diff --git a/cmdline/token_range.h b/cmdline/token_range.h
index e28ead9..e917e1d 100644
--- a/cmdline/token_range.h
+++ b/cmdline/token_range.h
@@ -81,7 +81,7 @@
   {}
 
   // Non-copying constructor. Retain reference to existing list of tokens.
-  TokenRange(std::shared_ptr<TokenList> token_list,
+  TokenRange(const std::shared_ptr<TokenList>& token_list,
              TokenList::const_iterator it_begin,
              TokenList::const_iterator it_end)
     : token_list_(token_list),
@@ -98,7 +98,7 @@
   TokenRange(TokenRange&&) = default;
 
   // Non-copying constructor. Retains reference to an existing list of tokens, with offset.
-  explicit TokenRange(std::shared_ptr<TokenList> token_list)
+  explicit TokenRange(const std::shared_ptr<TokenList>& token_list)
     : token_list_(token_list),
       begin_(token_list_->begin()),
       end_(token_list_->end())
diff --git a/cmdline/unit.h b/cmdline/unit.h
index f73981f..b049d62 100644
--- a/cmdline/unit.h
+++ b/cmdline/unit.h
@@ -27,7 +27,7 @@
   Unit() {}
   Unit(const Unit&) = default;
   ~Unit() {}
-  bool operator==(Unit) const {
+  bool operator==(const Unit&) const {
     return true;
   }
 };
diff --git a/compiler/utils/assembler_test.h b/compiler/utils/assembler_test.h
index bb22fe5..5c6bf13 100644
--- a/compiler/utils/assembler_test.h
+++ b/compiler/utils/assembler_test.h
@@ -259,7 +259,7 @@
                                               std::string (AssemblerTest::*GetName1)(const Reg1&),
                                               std::string (AssemblerTest::*GetName2)(const Reg2&),
                                               std::string (AssemblerTest::*GetName3)(const Reg3&),
-                                              std::string fmt,
+                                              const std::string& fmt,
                                               int bias) {
     std::string str;
     std::vector<int64_t> imms = CreateImmediateValuesBits(abs(imm_bits), (imm_bits > 0));
diff --git a/profman/profile_assistant_test.cc b/profman/profile_assistant_test.cc
index f446c09..7121697 100644
--- a/profman/profile_assistant_test.cc
+++ b/profman/profile_assistant_test.cc
@@ -267,7 +267,7 @@
 
   bool CreateAndDump(const std::string& input_file_contents,
                      std::string* output_file_contents,
-                     std::optional<const std::string> target = std::nullopt) {
+                     const std::optional<const std::string>& target = std::nullopt) {
     ScratchFile profile_file;
     EXPECT_TRUE(CreateProfile(input_file_contents,
                               profile_file.GetFilename(),
diff --git a/runtime/metrics/reporter_test.cc b/runtime/metrics/reporter_test.cc
index 3807c77..8117d49 100644
--- a/runtime/metrics/reporter_test.cc
+++ b/runtime/metrics/reporter_test.cc
@@ -411,7 +411,7 @@
       const std::string& spec_str,
       bool startup_first,
       bool continuous,
-      std::vector<uint32_t> periods) {
+      const std::vector<uint32_t>& periods) {
     Verify(spec_str, true, startup_first, continuous, periods);
   }
 
@@ -420,7 +420,7 @@
       bool valid,
       bool startup_first,
       bool continuous,
-      std::vector<uint32_t> periods) {
+      const std::vector<uint32_t>& periods) {
     std::string error_msg;
     std::optional<ReportingPeriodSpec> spec = ReportingPeriodSpec::Parse(spec_str, &error_msg);
 
diff --git a/runtime/subtype_check_info.h b/runtime/subtype_check_info.h
index d734557..05afd76 100644
--- a/runtime/subtype_check_info.h
+++ b/runtime/subtype_check_info.h
@@ -153,7 +153,7 @@
   // Create from the depth and the bitstring+of state.
   // This is done for convenience to avoid passing in "depth" everywhere,
   // since our current state is almost always a function of depth.
-  static SubtypeCheckInfo Create(SubtypeCheckBits compressed_value, size_t depth) {
+  static SubtypeCheckInfo Create(const SubtypeCheckBits& compressed_value, size_t depth) {
     SubtypeCheckInfo io;
     io.depth_ = depth;
     io.bitstring_and_of_ = compressed_value;
diff --git a/tools/jvmti-agents/chain-agents/chainagents.cc b/tools/jvmti-agents/chain-agents/chainagents.cc
index 1242409..d272fc1 100644
--- a/tools/jvmti-agents/chain-agents/chainagents.cc
+++ b/tools/jvmti-agents/chain-agents/chainagents.cc
@@ -53,7 +53,7 @@
   OnLoad,
 };
 
-static std::pair<std::string, std::string> Split(std::string source, char delim) {
+static std::pair<std::string, std::string> Split(const std::string& source, char delim) {
   std::string first(source.substr(0, source.find(delim)));
   if (source.find(delim) == std::string::npos) {
     return std::pair(first, "");
diff --git a/tools/jvmti-agents/simple-force-redefine/forceredefine.cc b/tools/jvmti-agents/simple-force-redefine/forceredefine.cc
index 055fb8a..3474238 100644
--- a/tools/jvmti-agents/simple-force-redefine/forceredefine.cc
+++ b/tools/jvmti-agents/simple-force-redefine/forceredefine.cc
@@ -94,7 +94,7 @@
   jvmtiEnv* jvmti_;
 };
 
-static void Transform(std::shared_ptr<ir::DexFile> ir) {
+static void Transform(const std::shared_ptr<ir::DexFile>& ir) {
   std::unique_ptr<ir::Builder> builder;
   for (auto& method : ir->encoded_methods) {
     // Do not look into abstract/bridge/native/synthetic methods.
diff --git a/tools/jvmti-agents/simple-profile/simple_profile.cc b/tools/jvmti-agents/simple-profile/simple_profile.cc
index 5ead97e..7161142 100644
--- a/tools/jvmti-agents/simple-profile/simple_profile.cc
+++ b/tools/jvmti-agents/simple-profile/simple_profile.cc
@@ -26,6 +26,7 @@
 #include <sstream>
 #include <string>
 #include <unordered_map>
+#include <utility>
 #include <vector>
 
 #include "android-base/unique_fd.h"
@@ -55,7 +56,7 @@
   SimpleProfileData(
       jvmtiEnv* env, std::string out_fd_name, int fd, bool dump_on_shutdown, bool dump_on_main_stop)
       : dump_id_(0),
-        out_fd_name_(out_fd_name),
+        out_fd_name_(std::move(out_fd_name)),
         out_fd_(fd),
         shutdown_(false),
         dump_on_shutdown_(dump_on_shutdown || dump_on_main_stop),
@@ -79,7 +80,7 @@
   void Shutdown(jvmtiEnv* jvmti, JNIEnv* jni);
 
  private:
-  void DoDump(jvmtiEnv* jvmti, JNIEnv* jni, std::unordered_map<jmethodID, uint64_t> copy);
+  void DoDump(jvmtiEnv* jvmti, JNIEnv* jni, const std::unordered_map<jmethodID, uint64_t>& copy);
 
   jlong dump_id_;
   jrawMonitorID mon_;
@@ -320,7 +321,7 @@
 
 void SimpleProfileData::DoDump(jvmtiEnv* jvmti,
                                JNIEnv* jni,
-                               std::unordered_map<jmethodID, uint64_t> copy) {
+                               const std::unordered_map<jmethodID, uint64_t>& copy) {
   std::ostringstream oss;
   oss << "[";
   bool is_first = true;