[clang] [Sema] Remove an unnecessary cast (NFC) (PR #146808)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 2 18:47:41 PDT 2025


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

The only use of BW is to initialize BitWidth.  This patch renames BW
to BitWdith while removing the cast statement.


>From 27461a27118922c384e6bd97b9d0a9d6848960dc Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 2 Jul 2025 09:39:56 -0700
Subject: [PATCH] [Sema] Remove an unnecessary cast (NFC)

The only use of BW is to initialize BitWidth.  This patch renames BW
to BitWdith while removing the cast statement.
---
 clang/lib/Sema/SemaDeclCXX.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index e8c65025bfe6d..773148500f0af 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -3431,7 +3431,7 @@ static bool IsUnusedPrivateField(const FieldDecl *FD) {
 NamedDecl *
 Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
                                MultiTemplateParamsArg TemplateParameterLists,
-                               Expr *BW, const VirtSpecifiers &VS,
+                               Expr *BitWidth, const VirtSpecifiers &VS,
                                InClassInitStyle InitStyle) {
   const DeclSpec &DS = D.getDeclSpec();
   DeclarationNameInfo NameInfo = GetNameForDeclarator(D);
@@ -3442,8 +3442,6 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
   if (Loc.isInvalid())
     Loc = D.getBeginLoc();
 
-  Expr *BitWidth = static_cast<Expr*>(BW);
-
   assert(isa<CXXRecordDecl>(CurContext));
   assert(!DS.isFriendSpecified());
 



More information about the cfe-commits mailing list