Now we have a proper C++ library, use std::unique_ptr.
Also remove the Android.libcxx.mk and other bits of stlport compatibility
mechanics.
Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
diff --git a/runtime/base/bit_vector_test.cc b/runtime/base/bit_vector_test.cc
index 990d1db..0f866a4 100644
--- a/runtime/base/bit_vector_test.cc
+++ b/runtime/base/bit_vector_test.cc
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#include "UniquePtrCompat.h"
+#include <memory>
+
#include "bit_vector.h"
#include "gtest/gtest.h"
@@ -40,7 +41,7 @@
BitVector::Iterator empty_iterator(&bv);
EXPECT_EQ(-1, empty_iterator.Next());
- UniquePtr<BitVector::Iterator> empty_iterator_on_heap(bv.GetIterator());
+ std::unique_ptr<BitVector::Iterator> empty_iterator_on_heap(bv.GetIterator());
EXPECT_EQ(-1, empty_iterator_on_heap->Next());
bv.SetBit(0);
diff --git a/runtime/base/histogram_test.cc b/runtime/base/histogram_test.cc
index d72ae47..454f2ab 100644
--- a/runtime/base/histogram_test.cc
+++ b/runtime/base/histogram_test.cc
@@ -14,11 +14,11 @@
* limitations under the License.
*/
+#include <memory>
+#include <sstream>
+
#include "gtest/gtest.h"
#include "histogram-inl.h"
-#include "UniquePtrCompat.h"
-
-#include <sstream>
namespace art {
@@ -34,7 +34,7 @@
// PerValue = hist->PercentileVal(0.50); finds the 50th percentile(median).
TEST(Histtest, MeanTest) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("MeanTest", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("MeanTest", 5));
double mean;
for (size_t Idx = 0; Idx < 90; Idx++) {
@@ -52,7 +52,7 @@
}
TEST(Histtest, VarianceTest) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("VarianceTest", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("VarianceTest", 5));
double variance;
hist->AddValue(9);
@@ -64,7 +64,7 @@
}
TEST(Histtest, Percentile) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("Percentile", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("Percentile", 5));
Histogram<uint64_t>::CumulativeData data;
double PerValue;
@@ -91,7 +91,7 @@
}
TEST(Histtest, UpdateRange) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("UpdateRange", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("UpdateRange", 5));
Histogram<uint64_t>::CumulativeData data;
double PerValue;
@@ -131,7 +131,7 @@
}
TEST(Histtest, Reset) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("Reset", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("Reset", 5));
double PerValue;
hist->AddValue(0);
@@ -174,7 +174,7 @@
}
TEST(Histtest, MultipleCreateHist) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("MultipleCreateHist", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("MultipleCreateHist", 5));
Histogram<uint64_t>::CumulativeData data;
double PerValue;
@@ -213,7 +213,7 @@
}
TEST(Histtest, SingleValue) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("SingleValue", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("SingleValue", 5));
Histogram<uint64_t>::CumulativeData data;
hist->AddValue(1);
@@ -225,7 +225,7 @@
}
TEST(Histtest, CappingPercentiles) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("CappingPercentiles", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("CappingPercentiles", 5));
Histogram<uint64_t>::CumulativeData data;
double per_995;
@@ -251,7 +251,7 @@
}
TEST(Histtest, SpikyValues) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("SpikyValues", 5, 4096));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("SpikyValues", 5, 4096));
Histogram<uint64_t>::CumulativeData data;
for (uint64_t idx = 0ull; idx < 30ull; idx++) {
diff --git a/runtime/base/logging.cc b/runtime/base/logging.cc
index b6c6b9b..b2ad1d0 100644
--- a/runtime/base/logging.cc
+++ b/runtime/base/logging.cc
@@ -19,7 +19,6 @@
#include "base/mutex.h"
#include "runtime.h"
#include "thread-inl.h"
-#include "UniquePtrCompat.h"
#include "utils.h"
namespace art {
@@ -31,9 +30,9 @@
unsigned int gAborting = 0;
static LogSeverity gMinimumLogSeverity = INFO;
-static UniquePtr<std::string> gCmdLine;
-static UniquePtr<std::string> gProgramInvocationName;
-static UniquePtr<std::string> gProgramInvocationShortName;
+static std::unique_ptr<std::string> gCmdLine;
+static std::unique_ptr<std::string> gProgramInvocationName;
+static std::unique_ptr<std::string> gProgramInvocationShortName;
const char* GetCmdLine() {
return (gCmdLine.get() != nullptr) ? gCmdLine->c_str() : nullptr;
diff --git a/runtime/base/logging.h b/runtime/base/logging.h
index 7800cfe..814195c 100644
--- a/runtime/base/logging.h
+++ b/runtime/base/logging.h
@@ -20,12 +20,13 @@
#include <cerrno>
#include <cstring>
#include <iostream> // NOLINT
+#include <memory>
#include <sstream>
#include <signal.h>
#include <vector>
+
#include "base/macros.h"
#include "log_severity.h"
-#include "UniquePtrCompat.h"
#define CHECK(x) \
if (UNLIKELY(!(x))) \
@@ -202,7 +203,7 @@
private:
static void LogLine(const LogMessageData& data, const char*);
- const UniquePtr<LogMessageData> data_;
+ const std::unique_ptr<LogMessageData> data_;
friend void HandleUnexpectedSignal(int signal_number, siginfo_t* info, void* raw_context);
friend class Mutex;
diff --git a/runtime/base/unix_file/random_access_file_test.h b/runtime/base/unix_file/random_access_file_test.h
index 67e8c22..1d0b866 100644
--- a/runtime/base/unix_file/random_access_file_test.h
+++ b/runtime/base/unix_file/random_access_file_test.h
@@ -18,11 +18,10 @@
#define ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_TEST_H_
#include <errno.h>
-
+#include <memory>
#include <string>
#include "common_runtime_test.h"
-#include "UniquePtrCompat.h"
namespace unix_file {
@@ -62,7 +61,7 @@
void TestRead() {
char buf[256];
- UniquePtr<RandomAccessFile> file(MakeTestFile());
+ std::unique_ptr<RandomAccessFile> file(MakeTestFile());
// Reading from the start of an empty file gets you zero bytes, however many
// you ask for.
@@ -77,7 +76,7 @@
void TestReadContent(const std::string& content, RandomAccessFile* file) {
const int buf_size = content.size() + 10;
- UniquePtr<char> buf(new char[buf_size]);
+ std::unique_ptr<char> buf(new char[buf_size]);
// Can't read from a negative offset.
ASSERT_EQ(-EINVAL, file->Read(buf.get(), 0, -123));
@@ -107,7 +106,7 @@
void TestSetLength() {
const std::string content("hello");
- UniquePtr<RandomAccessFile> file(MakeTestFile());
+ std::unique_ptr<RandomAccessFile> file(MakeTestFile());
ASSERT_EQ(content.size(), static_cast<uint64_t>(file->Write(content.data(), content.size(), 0)));
ASSERT_EQ(content.size(), static_cast<uint64_t>(file->GetLength()));
@@ -132,7 +131,7 @@
void TestWrite() {
const std::string content("hello");
- UniquePtr<RandomAccessFile> file(MakeTestFile());
+ std::unique_ptr<RandomAccessFile> file(MakeTestFile());
// Can't write to a negative offset.
ASSERT_EQ(-EINVAL, file->Write(content.data(), 0, -123));