[llvm] r371443 - [Remarks] Fix warning for uint8_t < 0 comparison
Francis Visoiu Mistrih via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 12:47:26 PDT 2019
Author: thegameg
Date: Mon Sep 9 12:47:25 2019
New Revision: 371443
URL: http://llvm.org/viewvc/llvm-project?rev=371443&view=rev
Log:
[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
Modified:
llvm/trunk/lib/Remarks/BitstreamRemarkParser.cpp
Modified: llvm/trunk/lib/Remarks/BitstreamRemarkParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Remarks/BitstreamRemarkParser.cpp?rev=371443&r1=371442&r2=371443&view=diff
==============================================================================
--- llvm/trunk/lib/Remarks/BitstreamRemarkParser.cpp (original)
+++ llvm/trunk/lib/Remarks/BitstreamRemarkParser.cpp Mon Sep 9 12:47:25 2019
@@ -365,8 +365,8 @@ Error BitstreamRemarkParser::processComm
"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(Bit
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.");
More information about the llvm-commits
mailing list