[clang] e44f776 - [CIR][NFC] Fix an unused variable warning (#137466)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 10:06:23 PDT 2025
Author: Amr Hesham
Date: 2025-04-28T19:06:20+02:00
New Revision: e44f7760fa6f9f2d70831a6e9bf9f8472d285f4d
URL: https://github.com/llvm/llvm-project/commit/e44f7760fa6f9f2d70831a6e9bf9f8472d285f4d
DIFF: https://github.com/llvm/llvm-project/commit/e44f7760fa6f9f2d70831a6e9bf9f8472d285f4d.diff
LOG: [CIR][NFC] Fix an unused variable warning (#137466)
This fixes a warning where a variable assigned in 'if' statement wasn't referenced again.
Added:
Modified:
clang/lib/CIR/CodeGen/CIRGenExpr.cpp
clang/lib/CIR/CodeGen/CIRGenModule.cpp
Removed:
################################################################################
diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
index 0a518c0fd935d..ff14798b9d34c 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
@@ -311,7 +311,7 @@ LValue CIRGenFunction::emitLValueForField(LValue base, const FieldDecl *field) {
assert(!cir::MissingFeatures::opTBAA());
Address addr = base.getAddress();
- if (auto *classDef = dyn_cast<CXXRecordDecl>(rec)) {
+ if (isa<CXXRecordDecl>(rec)) {
cgm.errorNYI(field->getSourceRange(), "emitLValueForField: C++ class");
return LValue();
}
@@ -701,7 +701,7 @@ CIRGenFunction::emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e) {
}
LValue CIRGenFunction::emitMemberExpr(const MemberExpr *e) {
- if (auto *vd = dyn_cast<VarDecl>(e->getMemberDecl())) {
+ if (isa<VarDecl>(e->getMemberDecl())) {
cgm.errorNYI(e->getSourceRange(), "emitMemberExpr: VarDecl");
return LValue();
}
@@ -734,7 +734,7 @@ LValue CIRGenFunction::emitMemberExpr(const MemberExpr *e) {
return lv;
}
- if (const auto *fd = dyn_cast<FunctionDecl>(nd)) {
+ if (isa<FunctionDecl>(nd)) {
cgm.errorNYI(e->getSourceRange(), "emitMemberExpr: FunctionDecl");
return LValue();
}
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 8aa57d1dbf9b3..b9cc2da583009 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -366,7 +366,7 @@ void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *vd,
bool isTentative) {
const QualType astTy = vd->getType();
const mlir::Type type = convertType(vd->getType());
- if (clang::IdentifierInfo *identifier = vd->getIdentifier()) {
+ if (vd->getIdentifier()) {
StringRef name = getMangledName(GlobalDecl(vd));
auto varOp =
builder.create<cir::GlobalOp>(getLoc(vd->getSourceRange()), name, type);
More information about the cfe-commits
mailing list