clang-tools
20.0.0git
llvm-project
clang-tools-extra
clang-tidy
abseil
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
15
namespace
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
22
class
StringFindStrContainsCheck
:
public
utils::TransformerClangTidyCheck
{
23
public
:
24
StringFindStrContainsCheck
(StringRef
Name
,
ClangTidyContext
*Context);
25
bool
isLanguageVersionSupported
(
const
LangOptions &LangOpts)
const override
;
26
void
storeOptions
(
ClangTidyOptions::OptionMap
&Opts)
override
;
27
28
private
:
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
Name
llvm::SmallString< 256U > Name
Definition:
ChainedComparisonCheck.cpp:42
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:69
clang::tidy::abseil::StringFindStrContainsCheck
Finds s.find(...) == string::npos comparisons (for various string-like types) and suggests replacing ...
Definition:
StringFindStrContainsCheck.h:22
clang::tidy::abseil::StringFindStrContainsCheck::storeOptions
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
Definition:
StringFindStrContainsCheck.cpp:99
clang::tidy::abseil::StringFindStrContainsCheck::isLanguageVersionSupported
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
Definition:
StringFindStrContainsCheck.cpp:94
clang::tidy::utils::TransformerClangTidyCheck
A base class for defining a ClangTidy check based on a RewriteRule.
Definition:
TransformerClangTidyCheck.h:38
clang::tidy::abseil
Definition:
AbseilTidyModule.cpp:33
clang::tidy::ClangTidyOptions::OptionMap
llvm::StringMap< ClangTidyValue > OptionMap
Definition:
ClangTidyOptions.h:126
Generated on Wed Nov 20 2024 18:24:36 for clang-tools by
1.9.6