Skip to content

[CIR][NFC] Fix an unused variable warning #136431

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

Merged
merged 1 commit into from
Apr 21, 2025

Conversation

AmrDeveloper
Copy link
Member

This fixes a warning where a variable assigned in 'if' statement wasn't referenced again.

@AmrDeveloper AmrDeveloper requested a review from andykaylor April 19, 2025 13:33
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Apr 19, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 19, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clangir

Author: Amr Hesham (AmrDeveloper)

Changes

This fixes a warning where a variable assigned in 'if' statement wasn't referenced again.


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

1 Files Affected:

  • (modified) clang/lib/CIR/CodeGen/CIRGenTypes.cpp (+2-2)
diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
index c286aef360b01..1e1a2c4fee585 100644
--- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
@@ -153,7 +153,7 @@ isSafeToConvert(const RecordDecl *rd, CIRGenTypes &cgt,
   // out, don't do it.  This includes virtual base classes which get laid out
   // when a class is translated, even though they aren't embedded by-value into
   // the class.
-  if (const CXXRecordDecl *crd = dyn_cast<CXXRecordDecl>(rd)) {
+  if (isa<CXXRecordDecl>(rd)) {
     assert(!cir::MissingFeatures::cxxSupport());
     cgt.getCGModule().errorNYI(rd->getSourceRange(),
                                "isSafeToConvert: CXXRecordDecl");
@@ -237,7 +237,7 @@ mlir::Type CIRGenTypes::convertRecordDeclType(const clang::RecordDecl *rd) {
   assert(insertResult && "isSafeToCovert() should have caught this.");
 
   // Force conversion of non-virtual base classes recursively.
-  if (const auto *cxxRecordDecl = dyn_cast<CXXRecordDecl>(rd)) {
+  if (isa<CXXRecordDecl>(rd)) {
     cgm.errorNYI(rd->getSourceRange(), "CXXRecordDecl");
   }
 

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bcardosolopes bcardosolopes merged commit 3d14596 into llvm:main Apr 21, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants