summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
authorBob Haarman <llvm@inglorion.net>2017-11-10 00:17:31 +0000
committerBob Haarman <llvm@inglorion.net>2017-11-10 00:17:31 +0000
commitc6bb9380e0e8a1cc8d14979eb0ae07ed538dd062 (patch)
treef0602bcdabc1080e7aedc8b329c29257b874281f /llvm/lib/Support/Windows/Path.inc
parent8ee82ed81b526aa39c2c116ae60366e9c0124abe (diff)
downloadbcm5719-llvm-c6bb9380e0e8a1cc8d14979eb0ae07ed538dd062.tar.gz
bcm5719-llvm-c6bb9380e0e8a1cc8d14979eb0ae07ed538dd062.zip
[support] allocate exact size required for mapping in Support/Windws/Path.inc
Summary: zturner suggested that mapped_file_region::init() on Windows seems to create mappings that are larger than they need to be: Offset+Size instead of Size. Indeed, that appears to be the case. I confirmed that tests pass with mappings of just Size bytes, and fail with Size-1 bytes, suggesting that Size is indeed the correct value. Reviewers: amccarth, zturner Reviewed By: zturner Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D39876 llvm-svn: 317850
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r--llvm/lib/Support/Windows/Path.inc4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index fede6027f9f..f65ed5c7337 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -734,8 +734,8 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
HANDLE FileMappingHandle =
::CreateFileMappingW(FileHandle, 0, flprotect,
- (Offset + Size) >> 32,
- (Offset + Size) & 0xffffffff,
+ Size >> 32,
+ Size & 0xffffffff,
0);
if (FileMappingHandle == NULL) {
std::error_code ec = mapWindowsError(GetLastError());
OpenPOWER on IntegriCloud