diff options
| -rw-r--r-- | dexlayout/dexlayout.cc | 2 | ||||
| -rw-r--r-- | profman/profman.cc | 4 | ||||
| -rw-r--r-- | runtime/class_linker.cc | 5 | ||||
| -rw-r--r-- | runtime/jit/profile_compilation_info.cc | 16 | ||||
| -rw-r--r-- | runtime/primitive.cc | 2 |
5 files changed, 14 insertions, 15 deletions
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc index 615bcf92ea..105610ebf7 100644 --- a/dexlayout/dexlayout.cc +++ b/dexlayout/dexlayout.cc @@ -1700,7 +1700,7 @@ void DexLayout::OutputDexFile(const DexFile* dex_file) { 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 fdb9a75a6f..dac95b8e18 100644 --- a/profman/profman.cc +++ b/profman/profman.cc @@ -418,7 +418,7 @@ class ProfMan FINAL { 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 @@ class ProfMan FINAL { } 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 8162a820e0..f936db92f5 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -3505,13 +3505,12 @@ ObjPtr<mirror::DexCache> ClassLinker::FindDexCache(Thread* self, const DexFile& 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 b23a86313f..a2c459c530 100644 --- a/runtime/jit/profile_compilation_info.cc +++ b/runtime/jit/profile_compilation_info.cc @@ -498,13 +498,13 @@ bool ProfileCompilationInfo::AddClassIndex(const std::string& dex_location, 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 @@ std::string ProfileCompilationInfo::DumpInfo(const std::vector<const DexFile*>* } } 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 2380284535..1ec345a359 100644 --- a/runtime/primitive.cc +++ b/runtime/primitive.cc @@ -44,7 +44,7 @@ static const char* kBoxedDescriptors[] = { "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, |