[PATCH] D80023: [clang-tidy] Add abseil-string-find-str-contains checker.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 19 14:53:49 PDT 2020


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp:72
+           binaryOperator(hasOperatorName("=="),
+                          hasEitherOperand(ignoringParenImpCasts(StringNpos)),
+                          hasEitherOperand(ignoringParenImpCasts(StringFind))),
----------------
ymandel wrote:
> Would `hasOperands` replace these two separate calls to `hasEitherOperand`? Same below lines 79-80 (I think it's a new matcher, fwiw).
Just added, I added it to remove calls of multiple hasEitherOperand calls for the reason of preventing the matchers matching the same operand. I just got a little lost in my previous comment


================
Comment at: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp:98
+    const LangOptions &LangOpts) const {
+  return LangOpts.CPlusPlus;
+}
----------------
nit: as abseil requires c++11, should this check also require c++11 support


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80023





More information about the cfe-commits mailing list