Author: Timm Baeder Date: 2025-05-30T17:26:30+02:00 New Revision: ccb6b0dafda22360edea8dbf515f78db3c31e807
URL: https://github.com/llvm/llvm-project/commit/ccb6b0dafda22360edea8dbf515f78db3c31e807 DIFF: https://github.com/llvm/llvm-project/commit/ccb6b0dafda22360edea8dbf515f78db3c31e807.diff LOG: [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. Added: Modified: clang/lib/Sema/SemaStmt.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index bc873937f6dc5..50f5757dff5bc 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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits