[PATCH] D126034: [clang-tidy] bugfix in InfiniteLoopCheck to not print warnings for unevaluated loops
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 23 15:31:04 PDT 2022
NoQ added inline comments.
================
Comment at: clang/include/clang/Analysis/Analyses/ExprMutationAnalyzer.h:43-44
+ ASTContext &Context);
+ static bool isUnevaluated(const Expr *Exp, const Stmt &Stm,
+ ASTContext &Context);
----------------
I suspect this may lead to subtle bugs when a `Stmt *` that actually points to an `Expr` at runtime would cause the first overload to be chosen.
Maybe teach `canResolveToExpr()` to accept an `Stmt` instead (with early return)?
================
Comment at: clang/lib/Analysis/ExprMutationAnalyzer.cpp:197
-bool ExprMutationAnalyzer::isUnevaluated(const Expr *Exp) {
- return selectFirst<Expr>(
+auto isUnevaluatedMatcher(const Stmt *Exp) {
+ return anyOf(
----------------
We're trying to avoid `auto` when it makes the code less readable i.e. when the type isn't obvious from the context (https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126034/new/
https://reviews.llvm.org/D126034
More information about the cfe-commits
mailing list