Eugene.Zelenko added a comment. It's good question where this check belongs. There are two loop related checks in CLang-tidy: bugprone-infinite-loop and bugprone-too-small-loop-variable.
================ Comment at: clang/lib/Sema/SemaStmt.cpp:1754 + if (!Cond->isRelationalOp()) return; + const auto Opcode = Cond->getOpcode(); + ---------------- Please don't use auto unless type is spelled in same statement or iterator. ================ Comment at: clang/lib/Sema/SemaStmt.cpp:1760 + const VarDecl *RightOperand = nullptr; + if (const DeclRefExpr *DRE = + dyn_cast<DeclRefExpr>(Cond->getLHS()->IgnoreParenImpCasts())) { ---------------- Please use const auto *, because type is spelled in same statement. ================ Comment at: clang/lib/Sema/SemaStmt.cpp:1764 + } + if (const DeclRefExpr *DRE = + dyn_cast<DeclRefExpr>(Cond->getRHS()->IgnoreParenImpCasts())) { ---------------- Please use const auto *, because type is spelled in same statement. ================ Comment at: clang/lib/Sema/SemaStmt.cpp:1780 + // Check that the loop step is an increment/decrement operation. + const UnaryOperator* Increment = dyn_cast<UnaryOperator>(Third); + if (!Increment) return; ---------------- Please use const auto *, because type is spelled in same statement. Please run clang-format over patch. ================ Comment at: clang/lib/Sema/SemaStmt.cpp:1784 + const VarDecl *IncrementOperand = nullptr; + if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>( + Increment->getSubExpr()->IgnoreParenImpCasts())) { ---------------- Please use const auto *, because type is spelled in same statement. ================ Comment at: clang/lib/Sema/SemaStmt.cpp:1813 + // One fix-it to reverse the condition operator. + const auto ReverseOpcode = BinaryOperator::reverseComparisonOp(Opcode); + const StringRef OperatorFixIt = ---------------- Please don't use auto unless type is spelled in same statement or iterator. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73762/new/ https://reviews.llvm.org/D73762 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits