Some code clean-up.
Change-Id: I4b745fd5298cd61c793e3b57514b48347bd66c0e
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index 9a5f74d..359d6af 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -150,8 +150,7 @@
}
// TODO: make selectable
- Compiler::Kind compiler_kind
- = (kUsePortableCompiler) ? Compiler::kPortable : Compiler::kQuick;
+ Compiler::Kind compiler_kind = kUsePortableCompiler ? Compiler::kPortable : Compiler::kQuick;
timer_.reset(new CumulativeLogger("Compilation times"));
compiler_driver_.reset(new CompilerDriver(compiler_options_.get(),
verification_results_.get(),
@@ -159,7 +158,7 @@
compiler_kind, instruction_set,
instruction_set_features_.get(),
true, new std::set<std::string>,
- 2, true, true, timer_.get()));
+ 2, true, true, timer_.get(), ""));
}
// We typically don't generate an image in unit tests, disable this optimization by default.
compiler_driver_->SetSupportBootImageFixup(false);
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index aac33d2..4b1063f 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -332,7 +332,7 @@
const InstructionSetFeatures* instruction_set_features,
bool image, std::set<std::string>* image_classes, size_t thread_count,
bool dump_stats, bool dump_passes, CumulativeLogger* timer,
- std::string profile_file)
+ const std::string& profile_file)
: profile_present_(false), compiler_options_(compiler_options),
verification_results_(verification_results),
method_inliner_map_(method_inliner_map),
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index 0425d27..74f6835 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -91,7 +91,7 @@
const InstructionSetFeatures* instruction_set_features,
bool image, std::set<std::string>* image_classes,
size_t thread_count, bool dump_stats, bool dump_passes,
- CumulativeLogger* timer, std::string profile_file = "");
+ CumulativeLogger* timer, const std::string& profile_file);
~CompilerDriver();
diff --git a/compiler/elf_writer_test.cc b/compiler/elf_writer_test.cc
index e479322..2ffbd10 100644
--- a/compiler/elf_writer_test.cc
+++ b/compiler/elf_writer_test.cc
@@ -17,6 +17,7 @@
#include "elf_file.h"
#include "base/stringprintf.h"
+#include "base/unix_file/fd_file.h"
#include "common_compiler_test.h"
#include "oat.h"
#include "utils.h"
diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc
index a9d30b6..847fa0d 100644
--- a/compiler/oat_test.cc
+++ b/compiler/oat_test.cc
@@ -44,11 +44,11 @@
compiler_driver_->GetCompiledMethod(MethodReference(dex_file,
method->GetDexMethodIndex()));
- if (compiled_method == NULL) {
- EXPECT_TRUE(oat_method.GetQuickCode() == NULL) << PrettyMethod(method) << " "
- << oat_method.GetQuickCode();
- EXPECT_TRUE(oat_method.GetPortableCode() == NULL) << PrettyMethod(method) << " "
- << oat_method.GetPortableCode();
+ if (compiled_method == nullptr) {
+ EXPECT_TRUE(oat_method.GetQuickCode() == nullptr) << PrettyMethod(method) << " "
+ << oat_method.GetQuickCode();
+ EXPECT_TRUE(oat_method.GetPortableCode() == nullptr) << PrettyMethod(method) << " "
+ << oat_method.GetPortableCode();
EXPECT_EQ(oat_method.GetFrameSizeInBytes(), 0U);
EXPECT_EQ(oat_method.GetCoreSpillMask(), 0U);
EXPECT_EQ(oat_method.GetFpSpillMask(), 0U);
@@ -109,9 +109,9 @@
verification_results_.get(),
method_inliner_map_.get(),
compiler_kind, insn_set,
- insn_features.get(), false, NULL, 2, true, true,
- timer_.get()));
- jobject class_loader = NULL;
+ insn_features.get(), false, nullptr, 2, true, true,
+ timer_.get(), ""));
+ jobject class_loader = nullptr;
if (kCompile) {
TimingLogger timings("OatTest::WriteRead", false, false);
compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings);
@@ -138,8 +138,8 @@
if (kCompile) { // OatWriter strips the code, regenerate to compare
compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings);
}
- std::unique_ptr<OatFile> oat_file(OatFile::Open(tmp.GetFilename(), tmp.GetFilename(), NULL, false,
- &error_msg));
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(tmp.GetFilename(), tmp.GetFilename(), nullptr,
+ false, &error_msg));
ASSERT_TRUE(oat_file.get() != nullptr) << error_msg;
const OatHeader& oat_header = oat_file->GetOatHeader();
ASSERT_TRUE(oat_header.IsValid());
@@ -159,7 +159,7 @@
const DexFile::ClassDef& class_def = dex_file->GetClassDef(i);
const uint8_t* class_data = dex_file->GetClassData(class_def);
size_t num_virtual_methods = 0;
- if (class_data != NULL) {
+ if (class_data != nullptr) {
ClassDataItemIterator it(*dex_file, class_data);
num_virtual_methods = it.NumVirtualMethods();
}
diff --git a/compiler/trampolines/trampoline_compiler.cc b/compiler/trampolines/trampoline_compiler.cc
index 6da375a..e793c6b 100644
--- a/compiler/trampolines/trampoline_compiler.cc
+++ b/compiler/trampolines/trampoline_compiler.cc
@@ -166,7 +166,7 @@
return x86_64::CreateTrampoline(offset);
default:
LOG(FATAL) << "Unexpected InstructionSet: " << isa;
- return nullptr;
+ UNREACHABLE();
}
}
@@ -182,7 +182,7 @@
return x86::CreateTrampoline(offset);
default:
LOG(FATAL) << "Unexpected InstructionSet: " << isa;
- return nullptr;
+ UNREACHABLE();
}
}