From f4ccd110750a3f3fe6a107d5c74c649c2a0dc407 Mon Sep 17 00:00:00 2001 From: Ahmed Charles Date: Thu, 6 Mar 2014 05:51:42 +0000 Subject: Replace OwningPtr with std::unique_ptr. This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Support/CompressionTest.cpp | 5 ++--- unittests/Support/LineIteratorTest.cpp | 30 +++++++++++++++--------------- unittests/Support/Path.cpp | 4 ++-- 3 files changed, 19 insertions(+), 20 deletions(-) (limited to 'unittests/Support') diff --git a/unittests/Support/CompressionTest.cpp b/unittests/Support/CompressionTest.cpp index c0a9adadb7..db6a8bb146 100644 --- a/unittests/Support/CompressionTest.cpp +++ b/unittests/Support/CompressionTest.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Compression.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringRef.h" #include "llvm/Config/config.h" #include "llvm/Support/MemoryBuffer.h" @@ -25,8 +24,8 @@ namespace { #if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ void TestZlibCompression(StringRef Input, zlib::CompressionLevel Level) { - OwningPtr Compressed; - OwningPtr Uncompressed; + std::unique_ptr Compressed; + std::unique_ptr Uncompressed; EXPECT_EQ(zlib::StatusOK, zlib::compress(Input, Compressed, Level)); // Check that uncompressed buffer is the same as original. EXPECT_EQ(zlib::StatusOK, zlib::uncompress(Compressed->getBuffer(), diff --git a/unittests/Support/LineIteratorTest.cpp b/unittests/Support/LineIteratorTest.cpp index d684e25df5..18f3fa99bc 100644 --- a/unittests/Support/LineIteratorTest.cpp +++ b/unittests/Support/LineIteratorTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/LineIterator.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/Support/MemoryBuffer.h" #include "gtest/gtest.h" @@ -18,9 +17,9 @@ using namespace llvm::sys; namespace { TEST(LineIteratorTest, Basic) { - OwningPtr Buffer(MemoryBuffer::getMemBuffer("line 1\n" - "line 2\n" - "line 3")); + std::unique_ptr Buffer(MemoryBuffer::getMemBuffer("line 1\n" + "line 2\n" + "line 3")); line_iterator I = line_iterator(*Buffer), E; @@ -42,11 +41,12 @@ TEST(LineIteratorTest, Basic) { } TEST(LineIteratorTest, CommentSkipping) { - OwningPtr Buffer(MemoryBuffer::getMemBuffer("line 1\n" - "line 2\n" - "# Comment 1\n" - "line 4\n" - "# Comment 2")); + std::unique_ptr Buffer( + MemoryBuffer::getMemBuffer("line 1\n" + "line 2\n" + "# Comment 1\n" + "line 4\n" + "# Comment 2")); line_iterator I = line_iterator(*Buffer, '#'), E; @@ -68,11 +68,11 @@ TEST(LineIteratorTest, CommentSkipping) { } TEST(LineIteratorTest, BlankSkipping) { - OwningPtr Buffer(MemoryBuffer::getMemBuffer("\n\n\n" - "line 1\n" - "\n\n\n" - "line 2\n" - "\n\n\n")); + std::unique_ptr Buffer(MemoryBuffer::getMemBuffer("\n\n\n" + "line 1\n" + "\n\n\n" + "line 2\n" + "\n\n\n")); line_iterator I = line_iterator(*Buffer), E; @@ -91,7 +91,7 @@ TEST(LineIteratorTest, BlankSkipping) { } TEST(LineIteratorTest, EmptyBuffers) { - OwningPtr Buffer(MemoryBuffer::getMemBuffer("")); + std::unique_ptr Buffer(MemoryBuffer::getMemBuffer("")); EXPECT_TRUE(line_iterator(*Buffer).is_at_eof()); EXPECT_EQ(line_iterator(), line_iterator(*Buffer)); diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp index 29a77f3780..d5bee7ae5d 100644 --- a/unittests/Support/Path.cpp +++ b/unittests/Support/Path.cpp @@ -555,7 +555,7 @@ TEST_F(FileSystemTest, CarriageReturn) { File << '\n'; } { - OwningPtr Buf; + std::unique_ptr Buf; MemoryBuffer::getFile(FilePathname.c_str(), Buf); EXPECT_EQ(Buf->getBuffer(), "\r\n"); } @@ -566,7 +566,7 @@ TEST_F(FileSystemTest, CarriageReturn) { File << '\n'; } { - OwningPtr Buf; + std::unique_ptr Buf; MemoryBuffer::getFile(FilePathname.c_str(), Buf); EXPECT_EQ(Buf->getBuffer(), "\n"); } -- cgit v1.2.3