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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 15 18:29:53 PDT 2020


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp:71-72
+           binaryOperator(hasOperatorName("=="),
+                          hasEitherOperand(ignoringParenImpCasts(StringNpos)),
+                          hasEitherOperand(ignoringParenImpCasts(StringFind))),
+           change(cat("!absl::StrContains(", node("string_being_searched"),
----------------
njames93 wrote:
> This is dangerous, it will match on `std::string::npos == std::string::npos` and (more importantly) `strA.find(...) == strB.find(...)`. See D80054.
Ignore me, its late.


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