aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-30 17:26:30 +0200
committerGitHub <noreply@github.com>2025-05-30 17:26:30 +0200
commitccb6b0dafda22360edea8dbf515f78db3c31e807 (patch)
tree80857d206ec26781e5c9c6617c953a94d1aada72 /clang/lib/Sema/SemaStmt.cpp
parent7f34d3acbac3df2bceb5f6450413706bde38908c (diff)
downloadllvm-ccb6b0dafda22360edea8dbf515f78db3c31e807.zip
llvm-ccb6b0dafda22360edea8dbf515f78db3c31e807.tar.gz
llvm-ccb6b0dafda22360edea8dbf515f78db3c31e807.tar.bz2
[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.
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index bc87393..50f5757 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2215,16 +2215,16 @@ namespace {
// Return when there is nothing to check.
if (!Body || !Third) return;
- if (S.Diags.isIgnored(diag::warn_redundant_loop_iteration,
- Third->getBeginLoc()))
- return;
-
// Get the last statement from the loop body.
CompoundStmt *CS = dyn_cast<CompoundStmt>(Body);
if (!CS || CS->body_empty()) return;
Stmt *LastStmt = CS->body_back();
if (!LastStmt) return;
+ if (S.Diags.isIgnored(diag::warn_redundant_loop_iteration,
+ Third->getBeginLoc()))
+ return;
+
bool LoopIncrement, LastIncrement;
DeclRefExpr *LoopDRE, *LastDRE;