Skip to content
Permalink
Browse files

[Remarks] Fix warning for uint8_t < 0 comparison

  • Loading branch information...
francisvm committed Sep 9, 2019
1 parent 9508738 commit 3d85013b63ea391ea966358bd5cbd24a78170c94
Showing with 4 additions and 4 deletions.
  1. +4 −4 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.");

0 comments on commit 3d85013

Please sign in to comment.
You can’t perform that action at this time.