[clang] [clang][NFC] Move Diags.isIgnored check later in checkForRedundantLoop (PR #141470)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon May 26 03:23:50 PDT 2025
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/141470
... Iteration.
>From 8849adcac5ffb09c72aa0e270891d508f074add3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 26 May 2025 12:21:04 +0200
Subject: [PATCH] [clang][NFC] Move Diags.isIgnored check later in
checkForRedundantLoop
... Iteration.
---
clang/lib/Sema/SemaStmt.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index ed070649dc1f9..6d6da6e7fdd8c 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2207,16 +2207,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;
More information about the cfe-commits
mailing list