[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

Matthias Gehre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 25 15:33:40 PDT 2020


mgehre marked 5 inline comments as done.
mgehre added a comment.

Aaron, thank you very much for taking the time to review this PR.



================
Comment at: clang-tools-extra/clang-tidy/readability/UseAnyOfAllOfCheck.cpp:61
+          hasBody(allOf(hasDescendant(returns(true)),
+                        unless(anyOf(hasDescendant(breakStmt()),
+                                     hasDescendant(returnsButNotTrue))))))
----------------
aaron.ballman wrote:
> Should we reject other ways to break out of the loop, like `goto` or `throw`?
I think throw statements still can be transformed. We cannot transform `break` because the loop is gone and we cannot transform `goto` because we cannot jump from the lambda into its caller.
But we can keep `throw` statements because exceptions can propagate from the lambda through the algorithm back into the original caller. If we could not allow `throw` statements, we would also have to disallow any other kind of call statements.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77572





More information about the cfe-commits mailing list