[PATCH] D43847: [clang-tidy] Add check: replace string::find(...) == 0 with absl::StartsWith

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 6 07:29:47 PST 2018


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

Looks good with a few nits.



================
Comment at: clang-tidy/abseil/AbseilTidyModule.cpp:15
+
+#include <cassert>
+
----------------
What is this header used for?


================
Comment at: clang-tidy/abseil/StringFindStartswithCheck.cpp:94
+
+  if (ComparisonExpr->getLocStart().isMacroID())
+    return;
----------------
nit: we can put it at the beginning of this method to make it early return if it is in macro. I think it is fine to ignore macro cases.


================
Comment at: docs/clang-tidy/checks/abseil-string-find-startswith.rst:30
+   Semicolon-separated list of names of string-like classes. By default only
+   ``std::basic_string`` is considered. The list of methods to consired is
+   fixed.
----------------
s/consired/considered


================
Comment at: test/clang-tidy/abseil-string-find-startswith.cpp:2
+// RUN: %check_clang_tidy %s abseil-string-find-startswith %t
+// -std=c++11
+
----------------
nit: -std=c++11 is not needed, it is on by default.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D43847





More information about the cfe-commits mailing list