mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
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
This commit is contained in:
parent
2ab3b563da
commit
819242a446
@ -546,8 +546,8 @@ getModuleForFile(LLVMContext &Context, claimed_file &F, raw_fd_ostream *ApiFile,
|
|||||||
if (get_view(F.handle, &View) != LDPS_OK)
|
if (get_view(F.handle, &View) != LDPS_OK)
|
||||||
message(LDPL_FATAL, "Failed to get a view of file");
|
message(LDPL_FATAL, "Failed to get a view of file");
|
||||||
|
|
||||||
std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer(
|
std::unique_ptr<MemoryBuffer> Buffer = MemoryBuffer::getMemBuffer(
|
||||||
StringRef((char *)View, File.filesize), "", false));
|
StringRef((char *)View, File.filesize), "", false);
|
||||||
|
|
||||||
if (release_input_file(F.handle) != LDPS_OK)
|
if (release_input_file(F.handle) != LDPS_OK)
|
||||||
message(LDPL_FATAL, "Failed to release file information");
|
message(LDPL_FATAL, "Failed to release file information");
|
||||||
|
@ -17,9 +17,9 @@ using namespace llvm::sys;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TEST(LineIteratorTest, Basic) {
|
TEST(LineIteratorTest, Basic) {
|
||||||
std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer("line 1\n"
|
std::unique_ptr<MemoryBuffer> Buffer = MemoryBuffer::getMemBuffer("line 1\n"
|
||||||
"line 2\n"
|
"line 2\n"
|
||||||
"line 3"));
|
"line 3");
|
||||||
|
|
||||||
line_iterator I = line_iterator(*Buffer), E;
|
line_iterator I = line_iterator(*Buffer), E;
|
||||||
|
|
||||||
@ -68,11 +68,11 @@ TEST(LineIteratorTest, CommentSkipping) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(LineIteratorTest, BlankSkipping) {
|
TEST(LineIteratorTest, BlankSkipping) {
|
||||||
std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer("\n\n\n"
|
std::unique_ptr<MemoryBuffer> Buffer = MemoryBuffer::getMemBuffer("\n\n\n"
|
||||||
"line 1\n"
|
"line 1\n"
|
||||||
"\n\n\n"
|
"\n\n\n"
|
||||||
"line 2\n"
|
"line 2\n"
|
||||||
"\n\n\n"));
|
"\n\n\n");
|
||||||
|
|
||||||
line_iterator I = line_iterator(*Buffer), E;
|
line_iterator I = line_iterator(*Buffer), E;
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ TEST(LineIteratorTest, BlankSkipping) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(LineIteratorTest, EmptyBuffers) {
|
TEST(LineIteratorTest, EmptyBuffers) {
|
||||||
std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer(""));
|
std::unique_ptr<MemoryBuffer> Buffer = MemoryBuffer::getMemBuffer("");
|
||||||
EXPECT_TRUE(line_iterator(*Buffer).is_at_eof());
|
EXPECT_TRUE(line_iterator(*Buffer).is_at_eof());
|
||||||
EXPECT_EQ(line_iterator(), line_iterator(*Buffer));
|
EXPECT_EQ(line_iterator(), line_iterator(*Buffer));
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace {
|
|||||||
class SpecialCaseListTest : public ::testing::Test {
|
class SpecialCaseListTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
SpecialCaseList *makeSpecialCaseList(StringRef List, std::string &Error) {
|
SpecialCaseList *makeSpecialCaseList(StringRef List, std::string &Error) {
|
||||||
std::unique_ptr<MemoryBuffer> MB(MemoryBuffer::getMemBuffer(List));
|
std::unique_ptr<MemoryBuffer> MB = MemoryBuffer::getMemBuffer(List);
|
||||||
return SpecialCaseList::create(MB.get(), Error);
|
return SpecialCaseList::create(MB.get(), Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user