[PATCH] D38132: [Support] mapped_file_region: store size as size_t

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 09:01:30 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL314312: [Support] mapped_file_region: store size as size_t (authored by lebedevri).

Changed prior to commit:
  https://reviews.llvm.org/D38132?vs=116208&id=116826#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38132

Files:
  llvm/trunk/include/llvm/Support/FileSystem.h
  llvm/trunk/lib/Support/Unix/Path.inc


Index: llvm/trunk/lib/Support/Unix/Path.inc
===================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc
+++ llvm/trunk/lib/Support/Unix/Path.inc
@@ -641,15 +641,9 @@
   return std::error_code();
 }
 
-mapped_file_region::mapped_file_region(int fd, mapmode mode, uint64_t length,
+mapped_file_region::mapped_file_region(int fd, mapmode mode, size_t length,
                                        uint64_t offset, std::error_code &ec)
     : 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;
-  }
-
   ec = init(fd, offset, mode);
   if (ec)
     Mapping = nullptr;
Index: llvm/trunk/include/llvm/Support/FileSystem.h
===================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h
+++ llvm/trunk/include/llvm/Support/FileSystem.h
@@ -745,7 +745,7 @@
 
 private:
   /// Platform-specific mapping state.
-  uint64_t Size;
+  size_t Size;
   void *Mapping;
 
   std::error_code init(int FD, uint64_t Offset, mapmode Mode);
@@ -758,12 +758,12 @@
   /// \param fd An open file descriptor to map. mapped_file_region takes
   ///   ownership if closefd is true. It must have been opended in the correct
   ///   mode.
-  mapped_file_region(int fd, mapmode mode, uint64_t length, uint64_t offset,
+  mapped_file_region(int fd, mapmode mode, size_t length, uint64_t offset,
                      std::error_code &ec);
 
   ~mapped_file_region();
 
-  uint64_t size() const;
+  size_t size() const;
   char *data() const;
 
   /// Get a const view of the data. Modifying this memory has undefined


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38132.116826.patch
Type: text/x-patch
Size: 1743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170927/75aa8fb4/attachment.bin>


More information about the llvm-commits mailing list