]> granicus.if.org Git - llvm/commit
[Support] mapped_file_region: store size as size_t
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 27 Sep 2017 15:59:16 +0000 (15:59 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 27 Sep 2017 15:59:16 +0000 (15:59 +0000)
commitaee6b7a6b8f2f9fd06bc5faf567af37486d1787a
tree3332dafc833c7b63b01b46460795e2def1a9d8bf
parenta7bf6677ff7978f5c604400e4e3c12ed667183fd
[Support] mapped_file_region: store size as size_t

Summary:
Found when testing stage-2 build with D38101.

```
In file included from /build/llvm/lib/Support/Path.cpp:1045:
/build/llvm/lib/Support/Unix/Path.inc:648:14: error: comparison 'uint64_t' (aka 'unsigned long') > 18446744073709551615 is always false [-Werror,-Wtautological-constant-compare]
  if (length > std::numeric_limits<size_t>::max()) {
      ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

`size_t` is `uint64_t` here, apparently, thus any `uint64_t` value
always fits into `size_t`.

Initial patch was to use some preprocessor logic to
not check if the size is known to fit at compile time.
But Zachary Turner suggested using this approach.

Reviewers: Bigcheese, rafael, zturner, mehdi_amini

Reviewed by (via email): zturner

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D38132

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314312 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/FileSystem.h
lib/Support/Unix/Path.inc