Fix -Wsign-compare warning with clang-cl

off_t apparently is just "long" on Win64, which is 32-bits, and
therefore not long enough to compare with UINT32_MAX. Use auto to follow
the surrounding code. uint64_t would also be fine.
This commit is contained in:
Reid Kleckner 2019-10-30 15:18:21 -07:00
parent 1c88d66223
commit 22d41ba024

View File

@ -114,7 +114,7 @@ llvm::Expected<uint64_t> FunctionInfo::encode(FileWriter &O) const {
llvm::Error err = OptLineTable->encode(O, Range.Start);
if (err)
return std::move(err);
const off_t Length = O.tell() - StartOffset;
const auto Length = O.tell() - StartOffset;
if (Length > UINT32_MAX)
return createStringError(std::errc::invalid_argument,
"LineTable length is greater than UINT32_MAX");
@ -132,7 +132,7 @@ llvm::Expected<uint64_t> FunctionInfo::encode(FileWriter &O) const {
llvm::Error err = Inline->encode(O, Range.Start);
if (err)
return std::move(err);
const off_t Length = O.tell() - StartOffset;
const auto Length = O.tell() - StartOffset;
if (Length > UINT32_MAX)
return createStringError(std::errc::invalid_argument,
"InlineInfo length is greater than UINT32_MAX");