[llvm] [CodeGen][DWARF][NFC] Add casts to a few asserts to avoid msvc warning. (PR #218386)

Matt Davis via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 05:24:17 PDT 2026


https://github.com/enferex created https://github.com/llvm/llvm-project/pull/218386

Fix some comparisons to correct the msvc warning: C4805: '==': unsafe mix of type 'IntType' and type 'bool' in operation

Assisted-by: LLM.

>From 8935b295bbd12e0f5c097620cb28ffcc42146195 Mon Sep 17 00:00:00 2001
From: Matt Davis <mattd at nvidia.com>
Date: Sun, 23 Aug 2026 11:25:20 +0000
Subject: [PATCH] [CodeGen][DWARF][NFC] Add casts to a few asserts to avoid
 msvc warning.

Fix some comparisons to correct the msvc warning: C4805: '==': unsafe mix of type 'IntType' and type 'bool' in operation

Assisted-by: LLM
---
 llvm/include/llvm/CodeGen/DIE.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/include/llvm/CodeGen/DIE.h b/llvm/include/llvm/CodeGen/DIE.h
index c01ea4cfedbae..bddbf9277cfbd 100644
--- a/llvm/include/llvm/CodeGen/DIE.h
+++ b/llvm/include/llvm/CodeGen/DIE.h
@@ -547,7 +547,8 @@ struct IntrusiveBackListBase {
 
   void push_back(Node &N) {
     assert(N.Next.getPointer() == &N && "Expected unlinked node");
-    assert(N.Next.getInt() == true && "Expected unlinked node");
+    assert(static_cast<bool>(N.Next.getInt()) == true &&
+           "Expected unlinked node");
 
     if (Last) {
       N.Next = Last->Next;
@@ -558,7 +559,8 @@ struct IntrusiveBackListBase {
 
   void push_front(Node &N) {
     assert(N.Next.getPointer() == &N && "Expected unlinked node");
-    assert(N.Next.getInt() == true && "Expected unlinked node");
+    assert(static_cast<bool>(N.Next.getInt()) == true &&
+           "Expected unlinked node");
 
     if (Last) {
       N.Next.setPointerAndInt(Last->Next.getPointer(), false);



More information about the llvm-commits mailing list