[llvm] [Bitcode] Get rid of compiler message (PR #113428)

Serge Pavlov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 08:39:26 PDT 2024


https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/113428

>From 3a2b57b9beecbcf6584f0e89e0144c422db6a245 Mon Sep 17 00:00:00 2001
From: Serge Pavlov <sepavloff at gmail.com>
Date: Wed, 23 Oct 2024 15:06:04 +0700
Subject: [PATCH] [Bitcode] Get rid of compiler message

Insert explicit cast from an enumerator to unsigned int, because
some compilers issue a warning on signed vs unsigned comparison,
see: https://github.com/llvm/llvm-project/pull/110805#issuecomment-2411095723.
---
 llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 5a6fb5064b3166..4aea059551dedc 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -798,7 +798,7 @@ class BitcodeReader : public BitcodeReaderBase, public GVMaterializer {
     if (Slot == Record.size())
       return true;
     unsigned ValID = Record[Slot++];
-    if (ValID != bitc::OB_METADATA) {
+    if (ValID != static_cast<unsigned>(bitc::OB_METADATA)) {
       unsigned TypeId;
       return getValueTypePair(Record, --Slot, InstNum, ResVal, TypeId,
                               ConstExprInsertBB);



More information about the llvm-commits mailing list