Skip to content

Commit 544093d

Browse files
bcardosolopeslanza
authored andcommitted
[CIR] More unused var warnings pt 2
1 parent c679f66 commit 544093d

File tree

5 files changed

+24
-21
lines changed

5 files changed

+24
-21
lines changed

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,10 +1137,10 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *E) {
11371137

11381138
// We can form DeclRefExprs naming GUID declarations when reconstituting
11391139
// non-type template parameters into expressions.
1140-
if (const auto *GD = dyn_cast<MSGuidDecl>(ND))
1140+
if (isa<MSGuidDecl>(ND))
11411141
llvm_unreachable("NYI");
11421142

1143-
if (const auto *TPO = dyn_cast<TemplateParamObjectDecl>(ND))
1143+
if (isa<TemplateParamObjectDecl>(ND))
11441144
llvm_unreachable("NYI");
11451145

11461146
llvm_unreachable("Unhandled DeclRefExpr");
@@ -1294,7 +1294,7 @@ Address CIRGenFunction::emitPointerWithAlignment(
12941294
/// expression and compare the result against zero, returning an Int1Ty value.
12951295
mlir::Value CIRGenFunction::evaluateExprAsBool(const Expr *E) {
12961296
// TODO(cir): PGO
1297-
if (const MemberPointerType *MPT = E->getType()->getAs<MemberPointerType>()) {
1297+
if (E->getType()->getAs<MemberPointerType>()) {
12981298
assert(0 && "not implemented");
12991299
}
13001300

@@ -1831,8 +1831,7 @@ LValue CIRGenFunction::emitArraySubscriptExpr(const ArraySubscriptExpr *E,
18311831
{Idx}, E->getType(), !getLangOpts().isSignedOverflowDefined(),
18321832
SignedIndices, CGM.getLoc(E->getExprLoc()), /*shouldDecay=*/false,
18331833
&ptrType, E->getBase());
1834-
} else if (const ObjCObjectType *OIT =
1835-
E->getType()->getAs<ObjCObjectType>()) {
1834+
} else if (E->getType()->getAs<ObjCObjectType>()) {
18361835
llvm_unreachable("ObjC object type subscript is NYI");
18371836
} else if (const Expr *Array = isSimpleArrayDecayOperand(E->getBase())) {
18381837
// If this is A[i] where A is an array, the frontend will have decayed
@@ -1908,6 +1907,8 @@ LValue CIRGenFunction::emitCastLValue(const CastExpr *E) {
19081907
switch (E->getCastKind()) {
19091908
case CK_HLSLArrayRValue:
19101909
case CK_HLSLVectorTruncation:
1910+
case CK_HLSLElementwiseCast:
1911+
case CK_HLSLAggregateSplatCast:
19111912
case CK_ToVoid:
19121913
case CK_BitCast:
19131914
case CK_LValueToRValueBitCast:
@@ -2147,7 +2148,7 @@ LValue CIRGenFunction::emitMemberExpr(const MemberExpr *E) {
21472148
return LV;
21482149
}
21492150

2150-
if (const auto *FD = dyn_cast<FunctionDecl>(ND))
2151+
if (isa<FunctionDecl>(ND))
21512152
assert(0 && "not implemented");
21522153

21532154
llvm_unreachable("Unhandled member declaration!");
@@ -2254,7 +2255,7 @@ static void pushTemporaryCleanup(CIRGenFunction &CGF,
22542255
// need to perform retain/release operations on the temporary.
22552256
//
22562257
// FIXME: This should be looking at E, not M.
2257-
if (auto Lifetime = M->getType().getObjCLifetime()) {
2258+
if ([[maybe_unused]] auto Lifetime = M->getType().getObjCLifetime()) {
22582259
assert(0 && "NYI");
22592260
}
22602261

@@ -2330,7 +2331,7 @@ LValue CIRGenFunction::emitMaterializeTemporaryExpr(
23302331
for (const auto &Ignored : CommaLHSs)
23312332
emitIgnoredExpr(Ignored);
23322333

2333-
if (const auto *opaque = dyn_cast<OpaqueValueExpr>(E))
2334+
if (isa<OpaqueValueExpr>(E))
23342335
assert(0 && "NYI");
23352336

23362337
// Create and initialize the reference temporary.
@@ -2424,7 +2425,7 @@ std::optional<LValue> HandleConditionalOperatorLValueSimpleCase(
24242425
}
24252426
// If a throw expression we emit it and return an undefined lvalue
24262427
// because it can't be used.
2427-
if (auto *ThrowExpr = dyn_cast<CXXThrowExpr>(Live->IgnoreParens())) {
2428+
if (isa<CXXThrowExpr>(Live->IgnoreParens())) {
24282429
llvm_unreachable("NYI");
24292430
}
24302431
return CGF.emitLValue(Live);
@@ -2439,7 +2440,7 @@ std::optional<LValue> HandleConditionalOperatorLValueSimpleCase(
24392440
/// LValue is returned and the current block has been terminated.
24402441
static std::optional<LValue> emitLValueOrThrowExpression(CIRGenFunction &CGF,
24412442
const Expr *Operand) {
2442-
if (auto *ThrowExpr = dyn_cast<CXXThrowExpr>(Operand->IgnoreParens())) {
2443+
if (isa<CXXThrowExpr>(Operand->IgnoreParens())) {
24432444
llvm_unreachable("NYI");
24442445
}
24452446

@@ -2599,7 +2600,7 @@ LValue CIRGenFunction::emitLValue(const Expr *E) {
25992600
return emitBinaryOperatorLValue(cast<BinaryOperator>(E));
26002601
case Expr::CompoundAssignOperatorClass: {
26012602
QualType Ty = E->getType();
2602-
if (const AtomicType *AT = Ty->getAs<AtomicType>())
2603+
if (Ty->getAs<AtomicType>())
26032604
assert(0 && "not yet implemented");
26042605
if (!Ty->isAnyComplexType())
26052606
return emitCompoundAssignmentLValue(cast<CompoundAssignOperator>(E));
@@ -2780,7 +2781,7 @@ mlir::Value CIRGenFunction::emitOpOnBoolExpr(mlir::Location loc,
27802781
// llvm_unreachable("binaryoperator ifstmt NYI");
27812782
// }
27822783

2783-
if (const UnaryOperator *CondUOp = dyn_cast<UnaryOperator>(cond)) {
2784+
if (isa<UnaryOperator>(cond)) {
27842785
// In LLVM the condition is reversed here for efficient codegen.
27852786
// This should be done in CIR prior to LLVM lowering, if we do now
27862787
// we can make CIR based diagnostics misleading.
@@ -2812,7 +2813,7 @@ mlir::Value CIRGenFunction::emitOpOnBoolExpr(mlir::Location loc,
28122813
getContext().BoolTy, CondOp->getExprLoc());
28132814
}
28142815

2815-
if (const CXXThrowExpr *Throw = dyn_cast<CXXThrowExpr>(cond)) {
2816+
if (isa<CXXThrowExpr>(cond)) {
28162817
llvm_unreachable("NYI");
28172818
}
28182819

@@ -3300,7 +3301,7 @@ LValue CIRGenFunction::emitPredefinedLValue(const PredefinedExpr *E) {
33003301
StringRef NameItems[] = {PredefinedExpr::getIdentKindName(E->getIdentKind()),
33013302
FnName};
33023303
std::string GVName = llvm::join(NameItems, NameItems + 2, ".");
3303-
if (auto *BD = dyn_cast_or_null<BlockDecl>(CurCodeDecl)) {
3304+
if (isa_and_nonnull<BlockDecl>(CurCodeDecl)) {
33043305
llvm_unreachable("NYI");
33053306
}
33063307

clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ RValue CIRGenFunction::emitCXXMemberOrOperatorMemberCallExpr(
227227
This = emitLValue(Base);
228228
}
229229

230-
if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(MD)) {
230+
if (isa<CXXConstructorDecl>(MD)) {
231231
llvm_unreachable("NYI");
232232
}
233233

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void CIRGenFunction::finishFunction(SourceLocation endLoc) {
565565
if (hasCleanups) {
566566
// Make sure the line table doesn't jump back into the body for
567567
// the ret after it's been at EndLoc.
568-
if (auto *di = getDebugInfo())
568+
if (getDebugInfo())
569569
assert(!cir::MissingFeatures::generateDebugInfo() && "NYI");
570570
// FIXME(cir): should we clearInsertionPoint? breaks many testcases
571571
PopCleanupBlocks(PrologueCleanupDepth);
@@ -1057,7 +1057,7 @@ void CIRGenFunction::StartFunction(GlobalDecl gd, QualType retTy,
10571057
// Ignore TSan memory acesses from within ObjC/ObjC++ dealloc, initialize,
10581058
// .cxx_destruct, __destroy_helper_block_ and all of their calees at run time.
10591059
if (SanOpts.has(SanitizerKind::Thread)) {
1060-
if (const auto *omd = dyn_cast_or_null<ObjCMethodDecl>(d)) {
1060+
if (isa_and_nonnull<ObjCMethodDecl>(d)) {
10611061
llvm_unreachable("NYI");
10621062
}
10631063
}
@@ -1103,8 +1103,7 @@ void CIRGenFunction::StartFunction(GlobalDecl gd, QualType retTy,
11031103
}
11041104

11051105
unsigned count, offset;
1106-
if (const auto *attr =
1107-
d ? d->getAttr<PatchableFunctionEntryAttr>() : nullptr) {
1106+
if (d && d->getAttr<PatchableFunctionEntryAttr>()) {
11081107
llvm_unreachable("NYI");
11091108
} else {
11101109
count = CGM.getCodeGenOpts().PatchableFunctionEntryCount;

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,11 @@ void CIRGenModule::emitGlobal(GlobalDecl gd) {
648648
assert(!cir::MissingFeatures::openMPRuntime());
649649
return;
650650
}
651-
if (auto *drd = dyn_cast<OMPDeclareReductionDecl>(global)) {
651+
if (isa<OMPDeclareReductionDecl>(global)) {
652652
assert(!cir::MissingFeatures::openMP());
653653
return;
654654
}
655-
if (auto *dmd = dyn_cast<OMPDeclareMapperDecl>(global)) {
655+
if (isa<OMPDeclareMapperDecl>(global)) {
656656
assert(!cir::MissingFeatures::openMP());
657657
return;
658658
}

clang/lib/CIR/CodeGen/CIRGenStmt.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *S,
106106

107107
switch (S->getStmtClass()) {
108108
case Stmt::OMPScopeDirectiveClass:
109+
case Stmt::OMPStripeDirectiveClass:
110+
case Stmt::OpenACCCacheConstructClass:
111+
case Stmt::OpenACCAtomicConstructClass:
109112
llvm_unreachable("NYI");
110113
case Stmt::OMPErrorDirectiveClass:
111114
case Stmt::NoStmtClass:

0 commit comments

Comments
 (0)