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

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 13:04:45 PDT 2020


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/UseAnyOfAllOfCheck.cpp:26
+AST_MATCHER_P(Stmt, nextStmt, internal::Matcher<Stmt>, InnerMatcher) {
+  const auto &Parents = Finder->getASTContext().getParents(Node);
+  if (Parents.size() != 1)
----------------
Please don't use auto unless type is spelled in same statement or iterator.


================
Comment at: clang-tools-extra/clang-tidy/readability/UseAnyOfAllOfCheck.cpp:55
+void UseAnyOfAllOfCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus)
+    return;
----------------
Must be in isLanguageVersionSupported() method.


================
Comment at: clang-tools-extra/clang-tidy/readability/UseAnyOfAllOfCheck.cpp:110
+        << Ranges;
+
+  } else if (const auto *S =
----------------
Unnecessary empty line.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:135
+
+  Finds range-based for loops that can be replaced by a call to std::any_of or
+  std::all_of.
----------------
Please enclose std::any_of and std::all_of in double back-ticks.


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