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

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 24 15:22:07 PDT 2022


ziqingluo-90 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) {
----------------
NoQ wrote:
> 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?
I think this is a good point.  I can do it after this patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128401/new/

https://reviews.llvm.org/D128401



More information about the cfe-commits mailing list