From 7291e0706e87ac921f263d16da2a8878d3e47c13 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 12 Dec 2014 17:35:34 +0000 Subject: [PATCH] Remove unused feature. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224135 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/FileOutputBuffer.h | 2 +- lib/Support/FileOutputBuffer.cpp | 8 +------- unittests/Support/FileOutputBufferTest.cpp | 5 ++--- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/include/llvm/Support/FileOutputBuffer.h b/include/llvm/Support/FileOutputBuffer.h index a7cfacd191b..9f02a16e3d6 100644 --- a/include/llvm/Support/FileOutputBuffer.h +++ b/include/llvm/Support/FileOutputBuffer.h @@ -66,7 +66,7 @@ public: /// is called, the file is deleted in the destructor. The optional parameter /// is used if it turns out you want the file size to be smaller than /// initially requested. - std::error_code commit(int64_t NewSmallerSize = -1); + std::error_code commit(); /// If this object was previously committed, the destructor just deletes /// this object. If this object was not committed, the destructor diff --git a/lib/Support/FileOutputBuffer.cpp b/lib/Support/FileOutputBuffer.cpp index 57a0f60d277..e6e4da34652 100644 --- a/lib/Support/FileOutputBuffer.cpp +++ b/lib/Support/FileOutputBuffer.cpp @@ -91,16 +91,10 @@ FileOutputBuffer::create(StringRef FilePath, size_t Size, return std::error_code(); } -std::error_code FileOutputBuffer::commit(int64_t NewSmallerSize) { +std::error_code FileOutputBuffer::commit() { // Unmap buffer, letting OS flush dirty pages to file on disk. Region.reset(); - // If requested, resize file as part of commit. - if ( NewSmallerSize != -1 ) { - std::error_code EC = sys::fs::resize_file(Twine(TempPath), NewSmallerSize); - if (EC) - return EC; - } // Rename file to final name. return sys::fs::rename(Twine(TempPath), Twine(FinalPath)); diff --git a/unittests/Support/FileOutputBufferTest.cpp b/unittests/Support/FileOutputBufferTest.cpp index 911d51613b1..c5e67d668ed 100644 --- a/unittests/Support/FileOutputBufferTest.cpp +++ b/unittests/Support/FileOutputBufferTest.cpp @@ -80,14 +80,13 @@ TEST(FileOutputBuffer, Test) { memcpy(Buffer->getBufferStart(), "AABBCCDDEEFFGGHHIIJJ", 20); // Write to end of buffer to verify it is writable. memcpy(Buffer->getBufferEnd() - 20, "AABBCCDDEEFFGGHHIIJJ", 20); - // Commit buffer, but size down to smaller size - ASSERT_NO_ERROR(Buffer->commit(5000)); + ASSERT_NO_ERROR(Buffer->commit()); } // Verify file is correct size. uint64_t File3Size; ASSERT_NO_ERROR(fs::file_size(Twine(File3), File3Size)); - ASSERT_EQ(File3Size, 5000ULL); + ASSERT_EQ(File3Size, 8192000ULL); ASSERT_NO_ERROR(fs::remove(File3.str())); // TEST 4: Verify file can be made executable. -- 2.34.1