[PATCH] D64736: [clang-tidy] New bugprone-infinite-loop check for detecting obvious infinite loops

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 07:01:48 PDT 2019


gribozavr added a comment.

Thanks for following up!



================
Comment at: clang-tidy/bugprone/InfiniteLoopCheck.cpp:53
+
+/// \brief Return whether `Var` has a pointer of reference in `S`.
+static bool hasPtrOrReferenceInStmt(const Stmt *S, const VarDecl *Var) {
----------------
Please delete "\brief" (everywhere in the patch) -- it is the default for the first sentence.

Also s/pointer of reference/pointer or reference/


================
Comment at: docs/clang-tidy/checks/bugprone-infinite-loop.rst:18
+- It is a local variable.
+- It has no reference or pointer aliases
+- It is not a structure or class member.
----------------
Please add a period at the end.


================
Comment at: test/clang-tidy/bugprone-infinite-loop.cpp:152
+  int *p = &i;
+}
+
----------------
I'd prefer you to add these tests back and add a short comment that this code triggers false negatives that are difficult to solve without CFG-based analysis.


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

https://reviews.llvm.org/D64736





More information about the cfe-commits mailing list