[PATCH] D128401: [Clang-tidy] Fixing a bug raising false alarms on static local variables in the Infinite Loop Checker
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 23 07:12:39 PDT 2022
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp:159
+ llvm::SmallSet<const Decl *, 16> &Callees) {
+ if (const CallExpr *Call = dyn_cast<CallExpr>(StmtNode)) {
+ const Decl *Callee = Call->getDirectCallee();
----------------
`auto` could be used, because type is spelled in same statement.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp:166
+ }
+ if (const ObjCMessageExpr *Call = dyn_cast<ObjCMessageExpr>(StmtNode)) {
+ const ObjCMethodDecl *Callee = Call->getMethodDecl();
----------------
Ditto.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp:200
+static bool hasStaticLocalVariable(const Stmt *Cond) {
+ if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Cond))
+ if (const VarDecl *VD = dyn_cast<VarDecl>(DRE->getDecl()))
----------------
Ditto.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp:201
+ if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Cond))
+ if (const VarDecl *VD = dyn_cast<VarDecl>(DRE->getDecl()))
+ if (VD->isStaticLocal())
----------------
Ditto.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128401/new/
https://reviews.llvm.org/D128401
More information about the cfe-commits
mailing list