[PATCH] D128401: [clang-tidy] Fixing a bug raising false alarms on static local variables in the Infinite Loop Checker

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 23:38:52 PDT 2022

NoQ added inline comments.

Comment at: clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp:34
 /// Return whether `Var` was changed in `LoopStmt`.
 static bool isChanged(const Stmt *LoopStmt, const VarDecl *Var,
                       ASTContext *Context) {
Ok so this whole checker does this procedure involving `ExprMutationAnalyzer` trying to figure out if the variable can be changed from within the loop. I wonder if our problem of whether the static variable can be changed within the loop is a sub-problem of this problem and therefore could have a general solution inside `ExprMutationAnalyzer`. If so, other clang-tidy checks that use `ExprMutationAnalyzer` could immediately benefit from such solution. WDYT?



More information about the cfe-commits mailing list