aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Remarks
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2019-09-09 19:47:25 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2019-09-09 19:47:25 +0000
commit3d85013b63ea391ea966358bd5cbd24a78170c94 (patch)
treec29aede0eab97b05605334fadff99e5c9cca85a3 /llvm/lib/Remarks
parent9508738cd1d4ad179021314bfe54f2a02cb029cd (diff)
downloadllvm-3d85013b63ea391ea966358bd5cbd24a78170c94.zip
llvm-3d85013b63ea391ea966358bd5cbd24a78170c94.tar.gz
llvm-3d85013b63ea391ea966358bd5cbd24a78170c94.tar.bz2
[Remarks] Fix warning for uint8_t < 0 comparison
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/19109/steps/build-stage1-compiler/logs/stdio llvm-svn: 371443
Diffstat (limited to 'llvm/lib/Remarks')
-rw-r--r--llvm/lib/Remarks/BitstreamRemarkParser.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Remarks/BitstreamRemarkParser.cpp b/llvm/lib/Remarks/BitstreamRemarkParser.cpp
index a65e845..2da2362 100644
--- a/llvm/lib/Remarks/BitstreamRemarkParser.cpp
+++ b/llvm/lib/Remarks/BitstreamRemarkParser.cpp
@@ -365,8 +365,8 @@ Error BitstreamRemarkParser::processCommonMeta(
"Error while parsing BLOCK_META: missing container version.");
if (Optional<uint8_t> Type = MetaHelper.ContainerType) {
- if (*Type < static_cast<uint8_t>(BitstreamRemarkContainerType::First) ||
- *Type > static_cast<uint8_t>(BitstreamRemarkContainerType::Last))
+ // Always >= BitstreamRemarkContainerType::First since it's unsigned.
+ if (*Type > static_cast<uint8_t>(BitstreamRemarkContainerType::Last))
return createStringError(
std::make_error_code(std::errc::illegal_byte_sequence),
"Error while parsing BLOCK_META: invalid container type.");
@@ -493,8 +493,8 @@ BitstreamRemarkParser::processRemark(BitstreamRemarkParserHelper &Helper) {
std::make_error_code(std::errc::illegal_byte_sequence),
"Error while parsing BLOCK_REMARK: missing remark type.");
- if (*Helper.Type < static_cast<uint8_t>(Type::First) ||
- *Helper.Type > static_cast<uint8_t>(Type::Last))
+ // Always >= Type::First since it's unsigned.
+ if (*Helper.Type > static_cast<uint8_t>(Type::Last))
return createStringError(
std::make_error_code(std::errc::illegal_byte_sequence),
"Error while parsing BLOCK_REMARK: unknown remark type.");