[llvm] r224312 - Remove the last unnecessary member variable of mapped_file_region. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Mon Dec 15 19:10:30 PST 2014
Author: rafael
Date: Mon Dec 15 21:10:29 2014
New Revision: 224312
URL: http://llvm.org/viewvc/llvm-project?rev=224312&view=rev
Log:
Remove the last unnecessary member variable of mapped_file_region. NFC.
Modified:
llvm/trunk/include/llvm/Support/FileSystem.h
llvm/trunk/lib/Support/Windows/Path.inc
Modified: llvm/trunk/include/llvm/Support/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=224312&r1=224311&r2=224312&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/FileSystem.h Mon Dec 15 21:10:29 2014
@@ -639,9 +639,6 @@ private:
/// Platform-specific mapping state.
uint64_t Size;
void *Mapping;
-#ifdef LLVM_ON_WIN32
- void *FileHandle;
-#endif
std::error_code init(int FD, uint64_t Offset, mapmode Mode);
Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=224312&r1=224311&r2=224312&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Mon Dec 15 21:10:29 2014
@@ -464,6 +464,10 @@ std::error_code mapped_file_region::init
if (Size > std::numeric_limits<SIZE_T>::max())
return make_error_code(errc::invalid_argument);
+ HANDLE FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(FD));
+ if (FileHandle == INVALID_HANDLE_VALUE)
+ return make_error_code(errc::bad_file_descriptor);
+
DWORD flprotect;
switch (Mode) {
case readonly: flprotect = PAGE_READONLY; break;
@@ -518,19 +522,10 @@ std::error_code mapped_file_region::init
mapped_file_region::mapped_file_region(int fd, mapmode mode, uint64_t length,
uint64_t offset, std::error_code &ec)
- : Size(length), Mapping(),
- FileHandle(INVALID_HANDLE_VALUE) {
- FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
- if (FileHandle == INVALID_HANDLE_VALUE) {
- ec = make_error_code(errc::bad_file_descriptor);
- return;
- }
-
+ : Size(length), Mapping() {
ec = init(fd, offset, mode);
- if (ec) {
+ if (ec)
Mapping = 0;
- FileHandle = INVALID_HANDLE_VALUE;
- }
}
mapped_file_region::~mapped_file_region() {
More information about the llvm-commits
mailing list