diff options
author | Rui Ueyama <ruiu@google.com> | 2019-01-19 00:07:57 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2019-01-19 00:07:57 +0000 |
commit | 8e7600dc43cab3bf006e2b12d288687b2b323f1b (patch) | |
tree | 06d49ceb19c2748f64558c431058ff727493a05b /llvm/unittests/Support/FileOutputBufferTest.cpp | |
parent | f9d76dc354230152013b91b0526419a01855042e (diff) | |
download | bcm5719-llvm-8e7600dc43cab3bf006e2b12d288687b2b323f1b.tar.gz bcm5719-llvm-8e7600dc43cab3bf006e2b12d288687b2b323f1b.zip |
Remove F_modify flag from FileOutputBuffer.
This code is dead. There is no use of the feature in the entire LLVM codebase.
Differential Revision: https://reviews.llvm.org/D56939
llvm-svn: 351613
Diffstat (limited to 'llvm/unittests/Support/FileOutputBufferTest.cpp')
-rw-r--r-- | llvm/unittests/Support/FileOutputBufferTest.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/llvm/unittests/Support/FileOutputBufferTest.cpp b/llvm/unittests/Support/FileOutputBufferTest.cpp index 554859587d4..ca5cc7d8c81 100644 --- a/llvm/unittests/Support/FileOutputBufferTest.cpp +++ b/llvm/unittests/Support/FileOutputBufferTest.cpp @@ -122,53 +122,4 @@ TEST(FileOutputBuffer, Test) { // Clean up. ASSERT_NO_ERROR(fs::remove(TestDirectory.str())); } - -TEST(FileOutputBuffer, TestModify) { - // Create unique temporary directory for these tests - SmallString<128> TestDirectory; - { - ASSERT_NO_ERROR( - fs::createUniqueDirectory("FileOutputBuffer-modify", TestDirectory)); - } - - SmallString<128> File1(TestDirectory); - File1.append("/file"); - // First write some data. - { - Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr = - FileOutputBuffer::create(File1, 10); - ASSERT_NO_ERROR(errorToErrorCode(BufferOrErr.takeError())); - std::unique_ptr<FileOutputBuffer> &Buffer = *BufferOrErr; - memcpy(Buffer->getBufferStart(), "AAAAAAAAAA", 10); - ASSERT_NO_ERROR(errorToErrorCode(Buffer->commit())); - } - - // Then re-open the file for modify and change only some bytes. - { - Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr = - FileOutputBuffer::create(File1, size_t(-1), FileOutputBuffer::F_modify); - ASSERT_NO_ERROR(errorToErrorCode(BufferOrErr.takeError())); - std::unique_ptr<FileOutputBuffer> &Buffer = *BufferOrErr; - ASSERT_EQ(10U, Buffer->getBufferSize()); - uint8_t *Data = Buffer->getBufferStart(); - Data[0] = 'X'; - Data[9] = 'X'; - ASSERT_NO_ERROR(errorToErrorCode(Buffer->commit())); - } - - // Finally, re-open the file for read and verify that it has the modified - // contents. - { - ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr = MemoryBuffer::getFile(File1); - ASSERT_NO_ERROR(BufferOrErr.getError()); - std::unique_ptr<MemoryBuffer> Buffer = std::move(*BufferOrErr); - ASSERT_EQ(10U, Buffer->getBufferSize()); - EXPECT_EQ(StringRef("XAAAAAAAAX"), Buffer->getBuffer()); - } - - // Clean up. - ASSERT_NO_ERROR(fs::remove(File1)); - ASSERT_NO_ERROR(fs::remove(TestDirectory)); -} - } // anonymous namespace |