ART: Fix some tidy warnings

Fix some tidy warnings for macros and references.

Test: m test-art-host
Change-Id: I2f8ed2174634263d4784c08e637f60ed70977b73
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index 615bcf9..105610e 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -1700,7 +1700,7 @@
   std::unique_ptr<File> new_file;
   if (!options_.output_to_memmap_) {
     std::string output_location(options_.output_dex_directory_);
-    size_t last_slash = dex_file_location.rfind("/");
+    size_t last_slash = dex_file_location.rfind('/');
     std::string dex_file_directory = dex_file_location.substr(0, last_slash + 1);
     if (output_location == dex_file_directory) {
       output_location = dex_file_location + ".new";
diff --git a/profman/profman.cc b/profman/profman.cc
index fdb9a75..dac95b8 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -418,7 +418,7 @@
     return true;
   }
 
-  bool GetClassNames(std::string profile_file,
+  bool GetClassNames(const std::string& profile_file,
                      std::vector<std::unique_ptr<const DexFile>>* dex_files,
                      std::set<std::string>* class_names) {
     int fd = open(profile_file.c_str(), O_RDONLY);
@@ -711,7 +711,7 @@
     }
     std::vector<ProfileMethodInfo::ProfileClassReference> classes(inline_cache_elems.size());
     size_t class_it = 0;
-    for (const std::string ic_class : inline_cache_elems) {
+    for (const std::string& ic_class : inline_cache_elems) {
       if (!FindClass(dex_files, ic_class, &(classes[class_it++]))) {
         LOG(ERROR) << "Could not find class: " << ic_class;
         return false;
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 8162a82..f936db9 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3505,13 +3505,12 @@
     return dex_cache;
   }
   // Failure, dump diagnostic and abort.
-  std::string location(dex_file.GetLocation());
   for (const DexCacheData& data : dex_caches_) {
     if (DecodeDexCache(self, data) != nullptr) {
-      LOG(ERROR) << "Registered dex file " << data.dex_file->GetLocation();
+      LOG(FATAL_WITHOUT_ABORT) << "Registered dex file " << data.dex_file->GetLocation();
     }
   }
-  LOG(FATAL) << "Failed to find DexCache for DexFile " << location;
+  LOG(FATAL) << "Failed to find DexCache for DexFile " << dex_file.GetLocation();
   UNREACHABLE();
 }
 
diff --git a/runtime/jit/profile_compilation_info.cc b/runtime/jit/profile_compilation_info.cc
index b23a863..a2c459c 100644
--- a/runtime/jit/profile_compilation_info.cc
+++ b/runtime/jit/profile_compilation_info.cc
@@ -498,13 +498,13 @@
   return true;
 }
 
-#define READ_UINT(type, buffer, dest, error)          \
-  do {                                                \
-    if (!buffer.ReadUintAndAdvance<type>(&dest)) {    \
-      *error = "Could not read "#dest;                \
-      return false;                                   \
-    }                                                 \
-  }                                                   \
+#define READ_UINT(type, buffer, dest, error)            \
+  do {                                                  \
+    if (!(buffer).ReadUintAndAdvance<type>(&(dest))) {  \
+      *(error) = "Could not read "#dest;                \
+      return false;                                     \
+    }                                                   \
+  }                                                     \
   while (false)
 
 bool ProfileCompilationInfo::ReadInlineCache(SafeBuffer& buffer,
@@ -1027,7 +1027,7 @@
       }
     }
     os << "\n\tmethods: ";
-    for (const auto method_it : dex_data.method_map) {
+    for (const auto& method_it : dex_data.method_map) {
       if (dex_file != nullptr) {
         os << "\n\t\t" << dex_file->PrettyMethod(method_it.first, true);
       } else {
diff --git a/runtime/primitive.cc b/runtime/primitive.cc
index 2380284..1ec345a 100644
--- a/runtime/primitive.cc
+++ b/runtime/primitive.cc
@@ -44,7 +44,7 @@
   "Ljava/lang/Void;",
 };
 
-#define COUNT_OF(x) (sizeof(x) / sizeof(x[0]))
+#define COUNT_OF(x) (sizeof(x) / sizeof((x)[0]))
 
 const char* Primitive::PrettyDescriptor(Primitive::Type type) {
   static_assert(COUNT_OF(kTypeNames) == static_cast<size_t>(Primitive::kPrimLast) + 1,