Go to the documentation of this file.
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_RENAMERCLANGTIDYCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_RENAMERCLANGTIDYCHECK_H
12 #include "../ClangTidyCheck.h"
13 #include "llvm/ADT/DenseMap.h"
14 #include "llvm/ADT/DenseSet.h"
15 #include "llvm/ADT/FunctionExtras.h"
16 #include "llvm/ADT/Optional.h"
39 check(
const ast_matchers::MatchFinder::MatchResult &Result)
override final;
41 Preprocessor *ModuleExpanderPP)
override final;
107 llvm::DenseMap<NamingCheckId, NamingCheckFailure>;
110 void checkMacro(SourceManager &sourceMgr,
const Token &MacroNameTok,
111 const MacroInfo *MI);
114 void expandMacro(
const Token &MacroNameTok,
const MacroInfo *MI);
126 virtual llvm::Optional<FailureInfo>
132 virtual llvm::Optional<FailureInfo>
134 const SourceManager &SM)
const = 0;
145 llvm::unique_function<void(DiagnosticBuilder &)>
ApplyArgs;
157 const bool AggressiveDependentMemberLookup;
163 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_RENAMERCLANGTIDYCHECK_H
CharSourceRange Range
SourceRange for the file name.
RenamerClangTidyCheck(StringRef CheckName, ClangTidyContext *Context)
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Derived classes that override this function should call this method from the overridden method.
bool ShouldFix() const
Whether the failure should be fixed or not.
Base class for all clang-tidy checks.
llvm::DenseMap< NamingCheckId, NamingCheckFailure > NamingCheckFailureMap
llvm::DenseSet< unsigned > RawUsageLocs
A set of all the identifier usages starting SourceLocation, in their encoded form.
Holds an identifier name check failure, tracking the kind of the identifier, its possible fixup and t...
Represents customized diagnostic text and how arguments should be applied.
llvm::SourceMgr * SourceMgr
void checkMacro(SourceManager &sourceMgr, const Token &MacroNameTok, const MacroInfo *MI)
Check Macros for style violations.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override final
ClangTidyChecks that register ASTMatchers should do the actual work in here.
virtual DiagInfo GetDiagInfo(const NamingCheckId &ID, const NamingCheckFailure &Failure) const =0
Overridden by derived classes, returns a description of the diagnostic that should be emitted for the...
virtual llvm::Optional< FailureInfo > GetDeclFailureInfo(const NamedDecl *Decl, const SourceManager &SM) const =0
Overridden by derived classes, returns information about if and how a Decl failed the check.
void onEndOfTranslationUnit() override final
ShouldFixStatus FixStatus
const FunctionDecl * Decl
ShouldFixStatus
This enum will be used in select of the diagnostic message.
bool ShouldNotify() const
If the identifier was used or declared within a macro we won't offer a fixup for safety reasons.
Values pass this threshold will be ignored completely i.e no message, no fixup.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void addUsage(const RenamerClangTidyCheck::NamingCheckId &Decl, SourceRange Range, SourceManager *SourceMgr=nullptr)
void expandMacro(const Token &MacroNameTok, const MacroInfo *MI)
Add a usage of a macro if it already has a violation.
Base class for clang-tidy checks that want to flag declarations and/or macros for renaming based on c...
std::pair< SourceLocation, std::string > NamingCheckId
void registerMatchers(ast_matchers::MatchFinder *Finder) override final
Derived classes should not implement any matching logic themselves; this class will do the matching a...
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override final
Override this to register PPCallbacks in the preprocessor.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
NamingCheckFailure()=default
llvm::unique_function< void(DiagnosticBuilder &)> ApplyArgs
The fixup will conflict with a macro definition, so we can't fix it automatically.
Information describing a failed check.
virtual llvm::Optional< FailureInfo > GetMacroFailureInfo(const Token &MacroNameTok, const SourceManager &SM) const =0
Overridden by derived classes, returns information about if and how a macro failed the check.
std::map< std::string, ClangTidyValue > OptionMap
The fixup will conflict with a language keyword, so we can't fix it automatically.