Skip to content

Commit e44f776

Browse files
authored
[CIR][NFC] Fix an unused variable warning (llvm#137466)
This fixes a warning where a variable assigned in 'if' statement wasn't referenced again.
1 parent b25b51e commit e44f776

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ LValue CIRGenFunction::emitLValueForField(LValue base, const FieldDecl *field) {
311311
assert(!cir::MissingFeatures::opTBAA());
312312

313313
Address addr = base.getAddress();
314-
if (auto *classDef = dyn_cast<CXXRecordDecl>(rec)) {
314+
if (isa<CXXRecordDecl>(rec)) {
315315
cgm.errorNYI(field->getSourceRange(), "emitLValueForField: C++ class");
316316
return LValue();
317317
}
@@ -701,7 +701,7 @@ CIRGenFunction::emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e) {
701701
}
702702

703703
LValue CIRGenFunction::emitMemberExpr(const MemberExpr *e) {
704-
if (auto *vd = dyn_cast<VarDecl>(e->getMemberDecl())) {
704+
if (isa<VarDecl>(e->getMemberDecl())) {
705705
cgm.errorNYI(e->getSourceRange(), "emitMemberExpr: VarDecl");
706706
return LValue();
707707
}
@@ -734,7 +734,7 @@ LValue CIRGenFunction::emitMemberExpr(const MemberExpr *e) {
734734
return lv;
735735
}
736736

737-
if (const auto *fd = dyn_cast<FunctionDecl>(nd)) {
737+
if (isa<FunctionDecl>(nd)) {
738738
cgm.errorNYI(e->getSourceRange(), "emitMemberExpr: FunctionDecl");
739739
return LValue();
740740
}

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *vd,
366366
bool isTentative) {
367367
const QualType astTy = vd->getType();
368368
const mlir::Type type = convertType(vd->getType());
369-
if (clang::IdentifierInfo *identifier = vd->getIdentifier()) {
369+
if (vd->getIdentifier()) {
370370
StringRef name = getMangledName(GlobalDecl(vd));
371371
auto varOp =
372372
builder.create<cir::GlobalOp>(getLoc(vd->getSourceRange()), name, type);

0 commit comments

Comments
 (0)