[clang] [AST] Remove an unnecessary cast (NFC) (PR #151278)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 29 23:20:31 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/151278

getSignificantBits() already returns unsigned.


>From b54d6c9890e2ea169ee70c7ba27ca4403b05b7d0 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 29 Jul 2025 09:04:49 -0700
Subject: [PATCH] [AST] Remove an unnecessary cast (NFC)

getSignificantBits() already returns unsigned.
---
 clang/include/clang/AST/ASTContext.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 0273109f8a698..3b98274a80420 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1818,7 +1818,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
         NumPositiveBits = std::max({NumPositiveBits, ActiveBits, 1u});
       } else {
         NumNegativeBits =
-            std::max(NumNegativeBits, (unsigned)InitVal.getSignificantBits());
+            std::max(NumNegativeBits, InitVal.getSignificantBits());
       }
 
       MembersRepresentableByInt &= isRepresentableIntegerValue(InitVal, IntTy);



More information about the cfe-commits mailing list