clang-tools 19.0.0git
StringFindStrContainsCheck.h
Go to the documentation of this file.
1//===--- StringFindStrContainsCheck.h - clang-tidy---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_STRINGFINDSTRCONTAINSCHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_STRINGFINDSTRCONTAINSCHECK_H
11
12#include "../ClangTidyCheck.h"
13#include "../utils/TransformerClangTidyCheck.h"
14
15namespace clang::tidy::abseil {
16
17/// Finds s.find(...) == string::npos comparisons (for various string-like
18/// types) and suggests replacing with absl::StrContains.
19///
20/// For the user-facing documentation see:
21/// http://clang.llvm.org/extra/clang-tidy/checks/abseil/string-find-str-contains.html
23public:
25 bool isLanguageVersionSupported(const LangOptions &LangOpts) const override;
26 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
27
28private:
29 const std::vector<StringRef> StringLikeClassesOption;
30 const StringRef AbseilStringsMatchHeaderOption;
31};
32
33} // namespace clang::tidy::abseil
34
35#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_STRINGFINDSTRCONTAINSCHECK_H
llvm::SmallString< 256U > Name
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Finds s.find(...) == string::npos comparisons (for various string-like types) and suggests replacing ...
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
A base class for defining a ClangTidy check based on a RewriteRule.
llvm::StringMap< ClangTidyValue > OptionMap