mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Remove dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224029 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -470,34 +470,6 @@ std::error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset)
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
mapped_file_region::mapped_file_region(const Twine &path,
|
||||
mapmode mode,
|
||||
uint64_t length,
|
||||
uint64_t offset,
|
||||
std::error_code &ec)
|
||||
: Mode(mode)
|
||||
, Size(length)
|
||||
, Mapping() {
|
||||
// Make sure that the requested size fits within SIZE_T.
|
||||
if (length > std::numeric_limits<size_t>::max()) {
|
||||
ec = make_error_code(errc::invalid_argument);
|
||||
return;
|
||||
}
|
||||
|
||||
SmallString<128> path_storage;
|
||||
StringRef name = path.toNullTerminatedStringRef(path_storage);
|
||||
int oflags = (mode == readonly) ? O_RDONLY : O_RDWR;
|
||||
int ofd = ::open(name.begin(), oflags);
|
||||
if (ofd == -1) {
|
||||
ec = std::error_code(errno, std::generic_category());
|
||||
return;
|
||||
}
|
||||
|
||||
ec = init(ofd, true, offset);
|
||||
if (ec)
|
||||
Mapping = nullptr;
|
||||
}
|
||||
|
||||
mapped_file_region::mapped_file_region(int fd,
|
||||
bool closefd,
|
||||
mapmode mode,
|
||||
@@ -528,11 +500,6 @@ mapped_file_region::mapped_file_region(mapped_file_region &&other)
|
||||
other.Mapping = nullptr;
|
||||
}
|
||||
|
||||
mapped_file_region::mapmode mapped_file_region::flags() const {
|
||||
assert(Mapping && "Mapping failed but used anyway!");
|
||||
return Mode;
|
||||
}
|
||||
|
||||
uint64_t mapped_file_region::size() const {
|
||||
assert(Mapping && "Mapping failed but used anyway!");
|
||||
return Size;
|
||||
|
||||
@@ -551,49 +551,6 @@ std::error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset)
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
mapped_file_region::mapped_file_region(const Twine &path,
|
||||
mapmode mode,
|
||||
uint64_t length,
|
||||
uint64_t offset,
|
||||
std::error_code &ec)
|
||||
: Mode(mode)
|
||||
, Size(length)
|
||||
, Mapping()
|
||||
, FileDescriptor()
|
||||
, FileHandle(INVALID_HANDLE_VALUE)
|
||||
, FileMappingHandle() {
|
||||
SmallVector<wchar_t, 128> path_utf16;
|
||||
|
||||
// Convert path to UTF-16.
|
||||
if ((ec = widenPath(path, path_utf16)))
|
||||
return;
|
||||
|
||||
// Get file handle for creating a file mapping.
|
||||
FileHandle = ::CreateFileW(c_str(path_utf16),
|
||||
Mode == readonly ? GENERIC_READ
|
||||
: GENERIC_READ | GENERIC_WRITE,
|
||||
Mode == readonly ? FILE_SHARE_READ
|
||||
: 0,
|
||||
0,
|
||||
Mode == readonly ? OPEN_EXISTING
|
||||
: OPEN_ALWAYS,
|
||||
Mode == readonly ? FILE_ATTRIBUTE_READONLY
|
||||
: FILE_ATTRIBUTE_NORMAL,
|
||||
0);
|
||||
if (FileHandle == INVALID_HANDLE_VALUE) {
|
||||
ec = windows_error(::GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
FileDescriptor = 0;
|
||||
ec = init(FileDescriptor, true, offset);
|
||||
if (ec) {
|
||||
Mapping = FileMappingHandle = 0;
|
||||
FileHandle = INVALID_HANDLE_VALUE;
|
||||
FileDescriptor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mapped_file_region::mapped_file_region(int fd,
|
||||
bool closefd,
|
||||
mapmode mode,
|
||||
@@ -640,11 +597,6 @@ mapped_file_region::mapped_file_region(mapped_file_region &&other)
|
||||
other.FileDescriptor = 0;
|
||||
}
|
||||
|
||||
mapped_file_region::mapmode mapped_file_region::flags() const {
|
||||
assert(Mapping && "Mapping failed but used anyway!");
|
||||
return Mode;
|
||||
}
|
||||
|
||||
uint64_t mapped_file_region::size() const {
|
||||
assert(Mapping && "Mapping failed but used anyway!");
|
||||
return Size;
|
||||
|
||||
Reference in New Issue
Block a user