clang-tools 22.0.0git
|
A base class for defining a ClangTidy check based on a RewriteRule. More...
#include <TransformerClangTidyCheck.h>
Public Member Functions | |
TransformerClangTidyCheck (StringRef Name, ClangTidyContext *Context) | |
TransformerClangTidyCheck (std::function< std::optional< transformer::RewriteRuleWith< std::string > >(const LangOptions &, const OptionsView &)> MakeRule, StringRef Name, ClangTidyContext *Context) | |
DEPRECATED: prefer the two argument constructor in conjunction with setRule . | |
TransformerClangTidyCheck (transformer::RewriteRuleWith< std::string > R, StringRef Name, ClangTidyContext *Context) | |
Convenience overload of the constructor when the rule doesn't have any dependencies. | |
void | registerPPCallbacks (const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override |
void | registerMatchers (ast_matchers::MatchFinder *Finder) final |
void | check (const ast_matchers::MatchFinder::MatchResult &Result) final |
void | storeOptions (ClangTidyOptions::OptionMap &Opts) override |
Derived classes that override this function should call this method from the overridden method. | |
void | setRule (transformer::RewriteRuleWith< std::string > R) |
Set the rule that this check implements. |
A base class for defining a ClangTidy check based on a RewriteRule.
Definition at line 38 of file TransformerClangTidyCheck.h.
clang::tidy::utils::TransformerClangTidyCheck::TransformerClangTidyCheck | ( | StringRef | Name, |
ClangTidyContext * | Context ) |
Definition at line 57 of file TransformerClangTidyCheck.cpp.
References clang::tidy::utils::IncludeSorter().
Referenced by clang::tidy::abseil::CleanupCtadCheck::CleanupCtadCheck(), clang::tidy::abseil::StringFindStrContainsCheck::StringFindStrContainsCheck(), clang::tidy::bugprone::StringviewNullptrCheck::StringviewNullptrCheck(), and clang::tidy::llvm_check::UseNewMlirOpBuilderCheck::UseNewMlirOpBuilderCheck().
clang::tidy::utils::TransformerClangTidyCheck::TransformerClangTidyCheck | ( | std::function< std::optional< transformer::RewriteRuleWith< std::string > >(const LangOptions &, const OptionsView &)> | MakeRule, |
StringRef | Name, | ||
ClangTidyContext * | Context ) |
DEPRECATED: prefer the two argument constructor in conjunction with setRule
.
MakeRule
generates the rewrite rule to be used by the check, based on the given language and clang-tidy options. It can return std::nullopt
to handle cases where the options disable the check.
See setRule
for constraints on the rule.
clang::tidy::utils::TransformerClangTidyCheck::TransformerClangTidyCheck | ( | transformer::RewriteRuleWith< std::string > | R, |
StringRef | Name, | ||
ClangTidyContext * | Context ) |
Convenience overload of the constructor when the rule doesn't have any dependencies.
|
final |
Definition at line 103 of file TransformerClangTidyCheck.cpp.
References clang::tidy::utils::escapeForDiagnostic().
|
final |
Definition at line 96 of file TransformerClangTidyCheck.cpp.
|
override |
Definition at line 91 of file TransformerClangTidyCheck.cpp.
void clang::tidy::utils::TransformerClangTidyCheck::setRule | ( | transformer::RewriteRuleWith< std::string > | R | ) |
Set the rule that this check implements.
All cases in the rule must have a non-null Explanation
, even though Explanation
is optional for RewriteRule in general. Because the primary purpose of clang-tidy checks is to provide users with diagnostics, we assume that a missing explanation is a bug. If no explanation is desired, indicate that explicitly (for example, by passing text("no explanation") to makeRule as the Explanation argument).
Definition at line 85 of file TransformerClangTidyCheck.cpp.
References clang::tidy::utils::verifyRule().
Referenced by clang::tidy::abseil::StringFindStrContainsCheck::StringFindStrContainsCheck().
|
override |
Derived classes that override this function should call this method from the overridden method.
Definition at line 153 of file TransformerClangTidyCheck.cpp.