HomePhabricator

[Support] mapped_file_region: store size as size_t

Description

[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

Details

Committed
lebedevriSep 27 2017, 8:59 AM
Differential Revision
D38132: [Support] mapped_file_region: store size as size_t
Parents
rL314311: [Sanitizers] Allocator: new "release memory to OS" implementation
Branches
Unknown
Tags
Unknown