[PATCH] D80023: [clang-tidy] Add abseil-string-find-str-contains checker.
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 15 11:26:25 PDT 2020
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp:18
+#include "clang/Tooling/Transformer/Stencil.h"
+#include <cassert>
+
----------------
asserts are not used.
================
Comment at: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp:35
+llvm::Optional<transformer::RewriteRule>
+MakeRule(const LangOptions &LangOpts,
+ const ClangTidyCheck::OptionsView &Options) {
----------------
Please use static instead of anonymous namespace for functions.
================
Comment at: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp:38
+ // Only support C++.
+ if (!LangOpts.CPlusPlus)
+ return llvm::None;
----------------
This belongs to isLanguageVersionSupported().
================
Comment at: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.h:16
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include <memory>
+#include <string>
----------------
STL containers are not used in header.
================
Comment at: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.h:32
+ StringFindStrContainsCheck(StringRef Name, ClangTidyContext *Context);
+};
+
----------------
storeOptions() is missing.
================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:78
^^^^^^^^^^
+- New :doc:`abseil-string-find-str-contains
+ <clang-tidy/checks/abseil-string-find-str-contains>` check.
----------------
Please separate with empty line.
================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:81
+
+ Finds string.find(...) == npos comparisons and suggests replacing with
+ absl::StrContains.
----------------
Please synchronize with first statement in documentation.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/list.rst:15
- `abseil-duration-addition <abseil-duration-addition.html>`_, "Yes"
- `abseil-duration-comparison <abseil-duration-comparison.html>`_, "Yes"
- `abseil-duration-conversion-cast <abseil-duration-conversion-cast.html>`_, "Yes"
- `abseil-duration-division <abseil-duration-division.html>`_, "Yes"
- `abseil-duration-factory-float <abseil-duration-factory-float.html>`_, "Yes"
- `abseil-duration-factory-scale <abseil-duration-factory-scale.html>`_, "Yes"
- `abseil-duration-subtraction <abseil-duration-subtraction.html>`_, "Yes"
- `abseil-duration-unnecessary-conversion <abseil-duration-unnecessary-conversion.html>`_, "Yes"
- `abseil-faster-strsplit-delimiter <abseil-faster-strsplit-delimiter.html>`_, "Yes"
+ `abseil-duration-addition <abseil-duration-addition.html>`_,
+ `abseil-duration-comparison <abseil-duration-comparison.html>`_,
----------------
Unrelated and incorrect changes.
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