Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kazutakahirata
Copy link
Contributor

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

The only use of BW is to initialize BitWidth.  This patch renames BW
to BitWdith while removing the cast statement.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 3, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 3, 2025

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/146808.diff

1 Files Affected:

  • (modified) clang/lib/Sema/SemaDeclCXX.cpp (+1-3)
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());
 

@kazutakahirata kazutakahirata merged commit 5df748d into llvm:main Jul 3, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250702_cast_clang_Sema_BitWidth branch July 3, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants