summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-08-25 23:49:50 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-08-25 23:49:50 +0000
commit7f57e05355a26018901a230c97a2be11e67074ff (patch)
tree640bcc23753564f6354ef441064b73bb948a8fd9
parent70f94cace70be42861ba0a433cfe4bdf6c892f7c (diff)
parent641a473912b3bcaaff2c71070611490b7c547cfc (diff)
Merge "ART: Fix reference-related warnings"
-rw-r--r--compiler/linker/arm/relative_patcher_arm_base.cc2
-rw-r--r--compiler/optimizing/emit_swap_mips_test.cc4
-rw-r--r--dex2oat/dex2oat_image_test.cc5
-rw-r--r--dex2oat/dex2oat_test.cc32
-rw-r--r--dexlayout/dexlayout_test.cc6
-rw-r--r--profman/profile_assistant_test.cc2
-rw-r--r--runtime/compiler_filter_test.cc4
-rw-r--r--runtime/runtime_callbacks_test.cc2
-rw-r--r--runtime/ti/agent.cc2
-rw-r--r--runtime/ti/agent.h2
10 files changed, 39 insertions, 22 deletions
diff --git a/compiler/linker/arm/relative_patcher_arm_base.cc b/compiler/linker/arm/relative_patcher_arm_base.cc
index 18ff1c9bb6..4ca5afe177 100644
--- a/compiler/linker/arm/relative_patcher_arm_base.cc
+++ b/compiler/linker/arm/relative_patcher_arm_base.cc
@@ -28,7 +28,7 @@ namespace linker {
class ArmBaseRelativePatcher::ThunkData {
public:
ThunkData(std::vector<uint8_t> code, uint32_t max_next_offset)
- : code_(code),
+ : code_(std::move(code)),
offsets_(),
max_next_offset_(max_next_offset),
pending_offset_(0u) {
diff --git a/compiler/optimizing/emit_swap_mips_test.cc b/compiler/optimizing/emit_swap_mips_test.cc
index 0d4e1c5c97..fa3c4dfba8 100644
--- a/compiler/optimizing/emit_swap_mips_test.cc
+++ b/compiler/optimizing/emit_swap_mips_test.cc
@@ -91,7 +91,9 @@ class EmitSwapMipsTest : public ::testing::Test {
return nullptr;
}
- void DriverWrapper(HParallelMove* move, std::string assembly_text, std::string test_name) {
+ void DriverWrapper(HParallelMove* move,
+ const std::string& assembly_text,
+ const std::string& test_name) {
codegen_->GetMoveResolver()->EmitNativeCode(move);
assembler_ = codegen_->GetAssembler();
assembler_->FinalizeCode();
diff --git a/dex2oat/dex2oat_image_test.cc b/dex2oat/dex2oat_image_test.cc
index 46c5f581b6..04c2fcdd4c 100644
--- a/dex2oat/dex2oat_image_test.cc
+++ b/dex2oat/dex2oat_image_test.cc
@@ -59,7 +59,7 @@ class Dex2oatImageTest : public CommonRuntimeTest {
size_t class_frequency = 1) {
size_t method_counter = 0;
size_t class_counter = 0;
- for (std::string dex : GetLibCoreDexFileNames()) {
+ for (const std::string& dex : GetLibCoreDexFileNames()) {
std::vector<std::unique_ptr<const DexFile>> dex_files;
std::string error_msg;
CHECK(DexFile::Open(dex.c_str(), dex, /*verify_checksum*/ false, &error_msg, &dex_files))
@@ -158,9 +158,6 @@ class Dex2oatImageTest : public CommonRuntimeTest {
argv.push_back("--host");
}
- ScratchFile file;
- const std::string image_prefix = file.GetFilename();
-
argv.push_back("--image=" + image_file_name_prefix + ".art");
argv.push_back("--oat-file=" + image_file_name_prefix + ".oat");
argv.push_back("--oat-location=" + image_file_name_prefix + ".oat");
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index dbb9dfc860..db70e78d22 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -89,13 +89,31 @@ class Dex2oatTest : public Dex2oatEnvironmentTest {
return status;
}
- void GenerateOdexForTest(const std::string& dex_location,
- const std::string& odex_location,
- CompilerFilter::Filter filter,
- const std::vector<std::string>& extra_args = {},
- bool expect_success = true,
- bool use_fd = false,
- std::function<void(const OatFile&)> check_oat = [](const OatFile&) {}) {
+ void GenerateOdexForTest(
+ const std::string& dex_location,
+ const std::string& odex_location,
+ CompilerFilter::Filter filter,
+ const std::vector<std::string>& extra_args = {},
+ bool expect_success = true,
+ bool use_fd = false) {
+ GenerateOdexForTest(dex_location,
+ odex_location,
+ filter,
+ extra_args,
+ expect_success,
+ use_fd,
+ [](const OatFile&) {});
+ }
+
+ template <typename T>
+ void GenerateOdexForTest(
+ const std::string& dex_location,
+ const std::string& odex_location,
+ CompilerFilter::Filter filter,
+ const std::vector<std::string>& extra_args,
+ bool expect_success,
+ bool use_fd,
+ T check_oat) {
std::string error_msg;
int status = GenerateOdexForTestWithStatus({dex_location},
odex_location,
diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc
index 165896736f..336eb5fbcc 100644
--- a/dexlayout/dexlayout_test.cc
+++ b/dexlayout/dexlayout_test.cc
@@ -380,7 +380,7 @@ class DexLayoutTest : public CommonRuntimeTest {
// Runs DexFileLayout test.
bool DexFileLayoutExec(std::string* error_msg) {
ScratchFile tmp_file;
- std::string tmp_name = tmp_file.GetFilename();
+ const std::string& tmp_name = tmp_file.GetFilename();
size_t tmp_last_slash = tmp_name.rfind('/');
std::string tmp_dir = tmp_name.substr(0, tmp_last_slash + 1);
@@ -415,7 +415,7 @@ class DexLayoutTest : public CommonRuntimeTest {
// for behavior consistency.
bool DexFileLayoutFixedPointExec(std::string* error_msg) {
ScratchFile tmp_file;
- std::string tmp_name = tmp_file.GetFilename();
+ const std::string& tmp_name = tmp_file.GetFilename();
size_t tmp_last_slash = tmp_name.rfind('/');
std::string tmp_dir = tmp_name.substr(0, tmp_last_slash + 1);
@@ -481,7 +481,7 @@ class DexLayoutTest : public CommonRuntimeTest {
// Runs UnreferencedCatchHandlerTest & Unreferenced0SizeCatchHandlerTest.
bool UnreferencedCatchHandlerExec(std::string* error_msg, const char* filename) {
ScratchFile tmp_file;
- std::string tmp_name = tmp_file.GetFilename();
+ const std::string& tmp_name = tmp_file.GetFilename();
size_t tmp_last_slash = tmp_name.rfind('/');
std::string tmp_dir = tmp_name.substr(0, tmp_last_slash + 1);
diff --git a/profman/profile_assistant_test.cc b/profman/profile_assistant_test.cc
index c78d34ebb3..8cbf8c331c 100644
--- a/profman/profile_assistant_test.cc
+++ b/profman/profile_assistant_test.cc
@@ -207,7 +207,7 @@ class ProfileAssistantTest : public CommonRuntimeTest {
return ExecAndReturnCode(argv_str, &error);
}
- bool CreateProfile(std::string profile_file_contents,
+ bool CreateProfile(const std::string& profile_file_contents,
const std::string& filename,
const std::string& dex_location) {
ScratchFile class_names_file;
diff --git a/runtime/compiler_filter_test.cc b/runtime/compiler_filter_test.cc
index 383f4e3666..9b4f845b2c 100644
--- a/runtime/compiler_filter_test.cc
+++ b/runtime/compiler_filter_test.cc
@@ -20,7 +20,7 @@
namespace art {
-static void TestCompilerFilterName(CompilerFilter::Filter filter, std::string name) {
+static void TestCompilerFilterName(CompilerFilter::Filter filter, const std::string& name) {
CompilerFilter::Filter parsed;
EXPECT_TRUE(CompilerFilter::ParseCompilerFilter(name.c_str(), &parsed));
EXPECT_EQ(filter, parsed);
@@ -28,7 +28,7 @@ static void TestCompilerFilterName(CompilerFilter::Filter filter, std::string na
EXPECT_EQ(name, CompilerFilter::NameOfFilter(filter));
}
-static void TestSafeModeFilter(CompilerFilter::Filter expected, std::string name) {
+static void TestSafeModeFilter(CompilerFilter::Filter expected, const std::string& name) {
CompilerFilter::Filter parsed;
EXPECT_TRUE(CompilerFilter::ParseCompilerFilter(name.c_str(), &parsed));
EXPECT_EQ(expected, CompilerFilter::GetSafeModeFilterFrom(parsed));
diff --git a/runtime/runtime_callbacks_test.cc b/runtime/runtime_callbacks_test.cc
index a4d6c3dd5e..ac2ed9e295 100644
--- a/runtime/runtime_callbacks_test.cc
+++ b/runtime/runtime_callbacks_test.cc
@@ -258,7 +258,7 @@ class ClassLoadCallbackRuntimeCallbacksTest : public RuntimeCallbacksTest {
/*out*/DexFile const** final_dex_file ATTRIBUTE_UNUSED,
/*out*/DexFile::ClassDef const** final_class_def ATTRIBUTE_UNUSED)
OVERRIDE REQUIRES_SHARED(Locks::mutator_lock_) {
- std::string location(initial_dex_file.GetLocation());
+ const std::string& location = initial_dex_file.GetLocation();
std::string event =
std::string("PreDefine:") + descriptor + " <" +
location.substr(location.rfind('/') + 1, location.size()) + ">";
diff --git a/runtime/ti/agent.cc b/runtime/ti/agent.cc
index 82b9af33d5..6ff966678a 100644
--- a/runtime/ti/agent.cc
+++ b/runtime/ti/agent.cc
@@ -123,7 +123,7 @@ void Agent::Unload() {
}
}
-Agent::Agent(std::string arg)
+Agent::Agent(const std::string& arg)
: dlopen_handle_(nullptr),
onload_(nullptr),
onattach_(nullptr),
diff --git a/runtime/ti/agent.h b/runtime/ti/agent.h
index f98e3878cc..d6f1f2ef06 100644
--- a/runtime/ti/agent.h
+++ b/runtime/ti/agent.h
@@ -77,7 +77,7 @@ class Agent {
return DoLoadHelper(true, call_res, error_msg);
}
- explicit Agent(std::string arg);
+ explicit Agent(const std::string& arg);
Agent(const Agent& other);
Agent& operator=(const Agent& other);