Revert "cleanup: Replace pointers with out-parameters and fix-up formatting"
This reverts commit a315f5c546b796f55f4872bb6efc15eb858d9639.
--
Revert "runtime: cleanup class_linker out-parameters and formatting"
This reverts commit bc1d78daa463572c5a770cdca858a3b51d8e1b7b.
--
Revert "base: replace raw pointers for out-parameters with safer out<T>"
This reverts commit fb326cffc679cab8eb873b9e44795706f023cb3c.
diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc
index 4a0de59..03ad2d5 100644
--- a/runtime/oat_file_assistant_test.cc
+++ b/runtime/oat_file_assistant_test.cc
@@ -26,7 +26,6 @@
#include <gtest/gtest.h>
#include "art_field-inl.h"
-#include "base/out.h"
#include "class_linker-inl.h"
#include "common_runtime_test.h"
#include "compiler_callbacks.h"
@@ -88,7 +87,7 @@
<< "Expected dex file to be at: " << GetDexSrc1();
ASSERT_TRUE(OS::FileExists(GetStrippedDexSrc1().c_str()))
<< "Expected stripped dex file to be at: " << GetStrippedDexSrc1();
- ASSERT_FALSE(DexFile::GetChecksum(GetStrippedDexSrc1().c_str(), &checksum, outof(error_msg)))
+ ASSERT_FALSE(DexFile::GetChecksum(GetStrippedDexSrc1().c_str(), &checksum, &error_msg))
<< "Expected stripped dex file to be stripped: " << GetStrippedDexSrc1();
ASSERT_TRUE(OS::FileExists(GetDexSrc2().c_str()))
<< "Expected dex file to be at: " << GetDexSrc2();
@@ -97,12 +96,12 @@
// GetMultiDexSrc1, but a different secondary dex checksum.
std::vector<std::unique_ptr<const DexFile>> multi1;
ASSERT_TRUE(DexFile::Open(GetMultiDexSrc1().c_str(),
- GetMultiDexSrc1().c_str(), outof(error_msg), &multi1)) << error_msg;
+ GetMultiDexSrc1().c_str(), &error_msg, &multi1)) << error_msg;
ASSERT_GT(multi1.size(), 1u);
std::vector<std::unique_ptr<const DexFile>> multi2;
ASSERT_TRUE(DexFile::Open(GetMultiDexSrc2().c_str(),
- GetMultiDexSrc2().c_str(), outof(error_msg), &multi2)) << error_msg;
+ GetMultiDexSrc2().c_str(), &error_msg, &multi2)) << error_msg;
ASSERT_GT(multi2.size(), 1u);
ASSERT_EQ(multi1[0]->GetLocationChecksum(), multi2[0]->GetLocationChecksum());
@@ -232,13 +231,13 @@
args.push_back("--runtime-arg");
args.push_back("-Xnorelocate");
std::string error_msg;
- ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, outof(error_msg))) << error_msg;
+ ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, &error_msg)) << error_msg;
setenv("ANDROID_DATA", android_data_.c_str(), 1);
// Verify the odex file was generated as expected.
std::unique_ptr<OatFile> odex_file(OatFile::Open(
odex_location.c_str(), odex_location.c_str(), nullptr, nullptr,
- false, dex_location.c_str(), outof(error_msg)));
+ false, dex_location.c_str(), &error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
if (!pic) {
@@ -284,7 +283,7 @@
image_reservation_.push_back(std::unique_ptr<MemMap>(
MemMap::MapAnonymous("image reservation",
reinterpret_cast<uint8_t*>(start), end - start,
- PROT_NONE, false, false, outof(error_msg))));
+ PROT_NONE, false, false, &error_msg)));
ASSERT_TRUE(image_reservation_.back().get() != nullptr) << error_msg;
LOG(INFO) << "Reserved space for image " <<
reinterpret_cast<void*>(image_reservation_.back()->Begin()) << "-" <<
@@ -319,7 +318,7 @@
OatFileAssistant oat_file_assistant(dex_location, kRuntimeISA, false);
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.GenerateOatFile(outof(error_msg))) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.GenerateOatFile(&error_msg)) << error_msg;
}
// Case: We have a DEX file, but no OAT file for it.
@@ -358,7 +357,7 @@
// Trying to make the oat file up to date should not fail or crash.
std::string error_msg;
- EXPECT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg)));
+ EXPECT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg));
// Trying to get the best oat file should fail, but not crash.
std::unique_ptr<OatFile> oat_file = oat_file_assistant.GetBestOatFile();
@@ -442,7 +441,7 @@
args.push_back("--oat-file=" + oat_location);
std::string error_msg;
- ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, outof(error_msg))) << error_msg;
+ ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, &error_msg)) << error_msg;
// Verify we can load both dex files.
OatFileAssistant oat_file_assistant(dex_location.c_str(),
@@ -541,7 +540,7 @@
// Make the oat file up to date.
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded());
@@ -597,7 +596,7 @@
// Make the oat file up to date.
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded());
@@ -645,7 +644,7 @@
// Make the oat file up to date. This should have no effect.
std::string error_msg;
- EXPECT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
+ EXPECT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded());
@@ -689,7 +688,7 @@
// Make the oat file up to date.
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded());
@@ -830,7 +829,7 @@
OatFileAssistant oat_file_assistant(
dex_location.c_str(), oat_location.c_str(), kRuntimeISA, true);
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
std::unique_ptr<OatFile> oat_file = oat_file_assistant.GetBestOatFile();
ASSERT_TRUE(oat_file.get() != nullptr);
@@ -920,7 +919,7 @@
// Trying to make it up to date should have no effect.
std::string error_msg;
- EXPECT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg)));
+ EXPECT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg));
EXPECT_TRUE(error_msg.empty());
}
@@ -959,9 +958,7 @@
ClassLinker* linker = Runtime::Current()->GetClassLinker();
std::vector<std::unique_ptr<const DexFile>> dex_files;
std::vector<std::string> error_msgs;
- dex_files = linker->OpenDexFilesFromOat(dex_location_.c_str(),
- oat_location_.c_str(),
- outof(error_msgs));
+ dex_files = linker->OpenDexFilesFromOat(dex_location_.c_str(), oat_location_.c_str(), &error_msgs);
CHECK(!dex_files.empty()) << Join(error_msgs, '\n');
CHECK(dex_files[0]->GetOatDexFile() != nullptr) << dex_files[0]->GetLocation();
loaded_oat_file_ = dex_files[0]->GetOatDexFile()->GetOatFile();
@@ -1058,17 +1055,17 @@
std::string odex_file;
EXPECT_TRUE(OatFileAssistant::DexFilenameToOdexFilename(
- "/foo/bar/baz.jar", kArm, &odex_file, outof(error_msg))) << error_msg;
+ "/foo/bar/baz.jar", kArm, &odex_file, &error_msg)) << error_msg;
EXPECT_EQ("/foo/bar/oat/arm/baz.odex", odex_file);
EXPECT_TRUE(OatFileAssistant::DexFilenameToOdexFilename(
- "/foo/bar/baz.funnyext", kArm, &odex_file, outof(error_msg))) << error_msg;
+ "/foo/bar/baz.funnyext", kArm, &odex_file, &error_msg)) << error_msg;
EXPECT_EQ("/foo/bar/oat/arm/baz.odex", odex_file);
EXPECT_FALSE(OatFileAssistant::DexFilenameToOdexFilename(
- "nopath.jar", kArm, &odex_file, outof(error_msg)));
+ "nopath.jar", kArm, &odex_file, &error_msg));
EXPECT_FALSE(OatFileAssistant::DexFilenameToOdexFilename(
- "/foo/bar/baz_noext", kArm, &odex_file, outof(error_msg)));
+ "/foo/bar/baz_noext", kArm, &odex_file, &error_msg));
}
// Verify the dexopt status values from dalvik.system.DexFile