9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_INCLUDECLEANER_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_INCLUDECLEANER_H
12#include "../ClangTidyCheck.h"
13#include "../ClangTidyDiagnosticConsumer.h"
14#include "../ClangTidyOptions.h"
15#include "clang-include-cleaner/Record.h"
16#include "clang-include-cleaner/Types.h"
17#include "clang/ASTMatchers/ASTMatchFinder.h"
18#include "clang/Basic/LLVM.h"
19#include "clang/Basic/SourceLocation.h"
20#include "clang/Lex/HeaderSearch.h"
21#include "clang/Lex/Preprocessor.h"
22#include "llvm/Support/Regex.h"
37 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
39 Preprocessor *ModuleExpanderPP)
override;
44 include_cleaner::RecordedPP RecordedPreprocessor;
45 include_cleaner::PragmaIncludes RecordedPI;
46 const Preprocessor *PP =
nullptr;
47 std::vector<StringRef> IgnoreHeaders;
49 const bool DeduplicateFindings;
50 llvm::SmallVector<llvm::Regex> IgnoreHeadersRegex;
51 bool shouldIgnore(
const include_cleaner::Header &H);
llvm::SmallString< 256U > Name
Base class for all clang-tidy checks.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Checks for unused and missing includes.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
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...
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override
Override this to register PPCallbacks in the preprocessor.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
llvm::StringMap< ClangTidyValue > OptionMap