[PATCH] D113499: [clang-tidy] Reduce false positives for `bugprone-infinite-loop` with dependent expressions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 10 06:55:08 PST 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Sorry about the delay in getting this reviewed, but it generally LGTM. Can you also add a release note about the fix? (I'm accepting the review and you can feel free to land with the requested changes made, but if you want another round of review before you land, just ask!)



================
Comment at: clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp:120
 
-static bool isKnownFalse(const Expr &Cond, const ASTContext &Ctx) {
-  if (Cond.isValueDependent())
+static bool isKnown(const Expr &Cond, const ASTContext &Ctx, const bool Value) {
+  if (Cond.isValueDependent()) {
----------------
My renaming may not be the best improvement to make, but `Value` wasn't giving me much indication of what to pass to it as a caller. It may also help to rename the function from `isKnown()` to `isKnownToHaveValue()` or something along those lines.


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

https://reviews.llvm.org/D113499



More information about the cfe-commits mailing list