[PATCH] D40937: [clang-tidy] Infinite loop checker
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 6 21:32:19 PST 2017
Eugene.Zelenko added inline comments.
================
Comment at: clang-tidy/misc/InfiniteLoopCheck.cpp:94
+
+std::unique_ptr<ExprSequence> createSequence(Stmt *FunctionBody,
+ ASTContext &ASTCtx) {
----------------
Missing static?
================
Comment at: clang-tidy/misc/InfiniteLoopCheck.cpp:102
+ if (!TheCFG)
+ return std::unique_ptr<ExprSequence>();
+
----------------
May be return {}?
================
Comment at: clang-tidy/misc/InfiniteLoopCheck.cpp:125
+
+ auto CondVarMatches =
+ match(findAll(declRefExpr(to(varDecl().bind("condvar")))), *Cond, ASTCtx);
----------------
const auto?
================
Comment at: clang-tidy/misc/InfiniteLoopCheck.cpp:130
+
+ for (auto &E : CondVarMatches) {
+ const VarDecl *CondVar = E.getNodeAs<VarDecl>("condvar");
----------------
const auto?
================
Comment at: clang-tidy/misc/InfiniteLoopCheck.cpp:142
+ // (excluding the init stmt).
+ if (auto ForLoop = dyn_cast<ForStmt>(LoopStmt)) {
+ if (ForLoop->getInc())
----------------
const auto?
================
Comment at: clang-tidy/misc/InfiniteLoopCheck.cpp:168
+ *FunctionBody, ASTCtx);
+ for (auto &ES : Match) {
+ if (Sequence->potentiallyAfter(LoopStmt, ES.getNodeAs<Stmt>("escStmt")))
----------------
const auto?
================
Comment at: clang-tidy/misc/InfiniteLoopCheck.cpp:176
+ std::string CondVarNames = "";
+ for (auto &CVM : CondVarMatches) {
+ CondVarNames += CVM.getNodeAs<VarDecl>("condvar")->getNameAsString() + ", ";
----------------
const auto?
https://reviews.llvm.org/D40937
More information about the cfe-commits
mailing list