From 819242a4468a8ad747a44a7153ff93542b8090d6 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 27 Aug 2014 20:14:18 +0000 Subject: [PATCH] Convert a few more cases of direct intialization of unique_ptrs from MemoryBuffer::getMemBuffer to move initialization now that it returns by unique_ptr instead of raw pointer. Cleanup/improvements following r216583. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216605 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/gold/gold-plugin.cpp | 4 ++-- unittests/Support/LineIteratorTest.cpp | 18 +++++++++--------- unittests/Support/SpecialCaseListTest.cpp | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index fd505b0bf15..69d33c9a8f9 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -546,8 +546,8 @@ getModuleForFile(LLVMContext &Context, claimed_file &F, raw_fd_ostream *ApiFile, if (get_view(F.handle, &View) != LDPS_OK) message(LDPL_FATAL, "Failed to get a view of file"); - std::unique_ptr Buffer(MemoryBuffer::getMemBuffer( - StringRef((char *)View, File.filesize), "", false)); + std::unique_ptr Buffer = MemoryBuffer::getMemBuffer( + StringRef((char *)View, File.filesize), "", false); if (release_input_file(F.handle) != LDPS_OK) message(LDPL_FATAL, "Failed to release file information"); diff --git a/unittests/Support/LineIteratorTest.cpp b/unittests/Support/LineIteratorTest.cpp index 2c8e1432bb3..8ec6c931e74 100644 --- a/unittests/Support/LineIteratorTest.cpp +++ b/unittests/Support/LineIteratorTest.cpp @@ -17,9 +17,9 @@ using namespace llvm::sys; namespace { TEST(LineIteratorTest, Basic) { - std::unique_ptr 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; @@ -68,11 +68,11 @@ TEST(LineIteratorTest, CommentSkipping) { } TEST(LineIteratorTest, BlankSkipping) { - std::unique_ptr 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) { - std::unique_ptr 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/SpecialCaseListTest.cpp b/unittests/Support/SpecialCaseListTest.cpp index bb9c351415b..1e13dba7753 100644 --- a/unittests/Support/SpecialCaseListTest.cpp +++ b/unittests/Support/SpecialCaseListTest.cpp @@ -18,7 +18,7 @@ namespace { class SpecialCaseListTest : public ::testing::Test { protected: SpecialCaseList *makeSpecialCaseList(StringRef List, std::string &Error) { - std::unique_ptr MB(MemoryBuffer::getMemBuffer(List)); + std::unique_ptr MB = MemoryBuffer::getMemBuffer(List); return SpecialCaseList::create(MB.get(), Error); } -- 2.34.1