llvm.org GIT mirror llvm / 819242a
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 David Blaikie 6 years ago
3 changed file(s) with 12 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
545545 if (get_view(F.handle, &View) != LDPS_OK)
546546 message(LDPL_FATAL, "Failed to get a view of file");
547547
548 std::unique_ptr Buffer(MemoryBuffer::getMemBuffer(
549 StringRef((char *)View, File.filesize), "", false));
548 std::unique_ptr Buffer = MemoryBuffer::getMemBuffer(
549 StringRef((char *)View, File.filesize), "", false);
550550
551551 if (release_input_file(F.handle) != LDPS_OK)
552552 message(LDPL_FATAL, "Failed to release file information");
1616 namespace {
1717
1818 TEST(LineIteratorTest, Basic) {
19 std::unique_ptr Buffer(MemoryBuffer::getMemBuffer("line 1\n"
20 "line 2\n"
21 "line 3"));
19 std::unique_ptr Buffer = MemoryBuffer::getMemBuffer("line 1\n"
20 "line 2\n"
21 "line 3");
2222
2323 line_iterator I = line_iterator(*Buffer), E;
2424
6767 }
6868
6969 TEST(LineIteratorTest, BlankSkipping) {
70 std::unique_ptr Buffer(MemoryBuffer::getMemBuffer("\n\n\n"
71 "line 1\n"
72 "\n\n\n"
73 "line 2\n"
74 "\n\n\n"));
70 std::unique_ptr Buffer = MemoryBuffer::getMemBuffer("\n\n\n"
71 "line 1\n"
72 "\n\n\n"
73 "line 2\n"
74 "\n\n\n");
7575
7676 line_iterator I = line_iterator(*Buffer), E;
7777
9090 }
9191
9292 TEST(LineIteratorTest, EmptyBuffers) {
93 std::unique_ptr Buffer(MemoryBuffer::getMemBuffer(""));
93 std::unique_ptr Buffer = MemoryBuffer::getMemBuffer("");
9494 EXPECT_TRUE(line_iterator(*Buffer).is_at_eof());
9595 EXPECT_EQ(line_iterator(), line_iterator(*Buffer));
9696
1717 class SpecialCaseListTest : public ::testing::Test {
1818 protected:
1919 SpecialCaseList *makeSpecialCaseList(StringRef List, std::string &Error) {
20 std::unique_ptr MB(MemoryBuffer::getMemBuffer(List));
20 std::unique_ptr MB = MemoryBuffer::getMemBuffer(List);
2121 return SpecialCaseList::create(MB.get(), Error);
2222 }
2323