Skip to content

Commit ccb6b0d

Browse files
authored
[clang][NFC] Move Diags.isIgnored check later in checkForRedundantLoop (#141470)
... Iteration. The `isIgnored()` check is more expensive than the earlier checks, so move it last.
1 parent 7f34d3a commit ccb6b0d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/Sema/SemaStmt.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,16 +2215,16 @@ namespace {
22152215
// Return when there is nothing to check.
22162216
if (!Body || !Third) return;
22172217

2218-
if (S.Diags.isIgnored(diag::warn_redundant_loop_iteration,
2219-
Third->getBeginLoc()))
2220-
return;
2221-
22222218
// Get the last statement from the loop body.
22232219
CompoundStmt *CS = dyn_cast<CompoundStmt>(Body);
22242220
if (!CS || CS->body_empty()) return;
22252221
Stmt *LastStmt = CS->body_back();
22262222
if (!LastStmt) return;
22272223

2224+
if (S.Diags.isIgnored(diag::warn_redundant_loop_iteration,
2225+
Third->getBeginLoc()))
2226+
return;
2227+
22282228
bool LoopIncrement, LastIncrement;
22292229
DeclRefExpr *LoopDRE, *LastDRE;
22302230

0 commit comments

Comments
 (0)