[llvm] 73ae678 - Fix MSVC signed/unsigned comparison warnings. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu May 28 05:08:40 PDT 2020
Author: Simon Pilgrim
Date: 2020-05-28T13:07:06+01:00
New Revision: 73ae678363fb42418a8959955d05488191045b31
URL: https://github.com/llvm/llvm-project/commit/73ae678363fb42418a8959955d05488191045b31
DIFF: https://github.com/llvm/llvm-project/commit/73ae678363fb42418a8959955d05488191045b31.diff
LOG: Fix MSVC signed/unsigned comparison warnings. NFC.
Added:
Modified:
llvm/lib/Support/FileCheck.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/FileCheck.cpp b/llvm/lib/Support/FileCheck.cpp
index 454f38132f6b..a1a37c972b8c 100644
--- a/llvm/lib/Support/FileCheck.cpp
+++ b/llvm/lib/Support/FileCheck.cpp
@@ -119,7 +119,7 @@ Expected<int64_t> ExpressionValue::getSignedValue() const {
if (Negative)
return getAsSigned(Value);
- if (Value > std::numeric_limits<int64_t>::max())
+ if (Value > (uint64_t)std::numeric_limits<int64_t>::max())
return make_error<OverflowError>();
// Value is in the representable range of int64_t so we can use cast.
@@ -187,7 +187,7 @@ Expected<ExpressionValue> llvm::operator-(const ExpressionValue &LeftOperand,
int64_t LeftValue = cantFail(LeftOperand.getSignedValue());
uint64_t RightValue = cantFail(RightOperand.getUnsignedValue());
// Result <= -1 - (max int64_t) which overflows on 1- and 2-complement.
- if (RightValue > std::numeric_limits<int64_t>::max())
+ if (RightValue > (uint64_t)std::numeric_limits<int64_t>::max())
return make_error<OverflowError>();
Optional<int64_t> Result =
checkedSub(LeftValue, static_cast<int64_t>(RightValue));
More information about the llvm-commits
mailing list