[clang] 720d7e0 - [CIR][NFC] Fix an unused variable warning (#145922)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 26 09:32:41 PDT 2025


Author: Amr Hesham
Date: 2025-06-26T18:32:38+02:00
New Revision: 720d7e09b322f017f7c089f87ddc3ed077df619c

URL: https://github.com/llvm/llvm-project/commit/720d7e09b322f017f7c089f87ddc3ed077df619c
DIFF: https://github.com/llvm/llvm-project/commit/720d7e09b322f017f7c089f87ddc3ed077df619c.diff

LOG: [CIR][NFC] Fix an unused variable warning (#145922)

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

Added: 
    

Modified: 
    clang/lib/CIR/CodeGen/CIRGenModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index f24bee44f26a7..44ec99b6a085a 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -427,9 +427,9 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd,
   setNonAliasAttributes(gd, funcOp);
   assert(!cir::MissingFeatures::opFuncAttributesForDefinition());
 
-  if (const ConstructorAttr *ca = funcDecl->getAttr<ConstructorAttr>())
+  if (funcDecl->getAttr<ConstructorAttr>())
     errorNYI(funcDecl->getSourceRange(), "constructor attribute");
-  if (const DestructorAttr *da = funcDecl->getAttr<DestructorAttr>())
+  if (funcDecl->getAttr<DestructorAttr>())
     errorNYI(funcDecl->getSourceRange(), "destructor attribute");
 
   if (funcDecl->getAttr<AnnotateAttr>())
@@ -1055,7 +1055,7 @@ cir::GlobalLinkageKind CIRGenModule::getFunctionLinkage(GlobalDecl gd) {
 
   GVALinkage linkage = astContext.GetGVALinkageForFunction(fd);
 
-  if (const auto *dtor = dyn_cast<CXXDestructorDecl>(fd))
+  if (isa<CXXDestructorDecl>(fd))
     errorNYI(fd->getSourceRange(), "getFunctionLinkage: CXXDestructorDecl");
 
   return getCIRLinkageForDeclarator(fd, linkage, /*IsConstantVariable=*/false);


        


More information about the cfe-commits mailing list