llvm.org GIT mirror llvm / 7291e07
Remove unused feature. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224135 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
3 changed file(s) with 4 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
6565 /// is called, the file is deleted in the destructor. The optional parameter
6666 /// is used if it turns out you want the file size to be smaller than
6767 /// initially requested.
68 std::error_code commit(int64_t NewSmallerSize = -1);
68 std::error_code commit();
6969
7070 /// If this object was previously committed, the destructor just deletes
7171 /// this object. If this object was not committed, the destructor
9090 return std::error_code();
9191 }
9292
93 std::error_code FileOutputBuffer::commit(int64_t NewSmallerSize) {
93 std::error_code FileOutputBuffer::commit() {
9494 // Unmap buffer, letting OS flush dirty pages to file on disk.
9595 Region.reset();
9696
97 // If requested, resize file as part of commit.
98 if ( NewSmallerSize != -1 ) {
99 std::error_code EC = sys::fs::resize_file(Twine(TempPath), NewSmallerSize);
100 if (EC)
101 return EC;
102 }
10397
10498 // Rename file to final name.
10599 return sys::fs::rename(Twine(TempPath), Twine(FinalPath));
7979 memcpy(Buffer->getBufferStart(), "AABBCCDDEEFFGGHHIIJJ", 20);
8080 // Write to end of buffer to verify it is writable.
8181 memcpy(Buffer->getBufferEnd() - 20, "AABBCCDDEEFFGGHHIIJJ", 20);
82 // Commit buffer, but size down to smaller size
83 ASSERT_NO_ERROR(Buffer->commit(5000));
82 ASSERT_NO_ERROR(Buffer->commit());
8483 }
8584
8685 // Verify file is correct size.
8786 uint64_t File3Size;
8887 ASSERT_NO_ERROR(fs::file_size(Twine(File3), File3Size));
89 ASSERT_EQ(File3Size, 5000ULL);
88 ASSERT_EQ(File3Size, 8192000ULL);
9089 ASSERT_NO_ERROR(fs::remove(File3.str()));
9190
9291 // TEST 4: Verify file can be made executable.