10 #include "../ClangTidy.h" 11 #include "../ClangTidyForceLinker.h" 12 #include "../ClangTidyModule.h" 13 #include "clang/Frontend/CompilerInstance.h" 14 #include "clang/Frontend/FrontendPluginRegistry.h" 15 #include "clang/Frontend/MultiplexConsumer.h" 26 std::unique_ptr<ClangTidyContext> Context;
29 WrapConsumer(std::unique_ptr<ClangTidyContext> Context,
30 std::vector<std::unique_ptr<ASTConsumer>> Consumer)
36 StringRef File)
override {
38 Context->setDiagnosticsEngine(&Compiler.getDiagnostics());
42 std::vector<std::unique_ptr<ASTConsumer>> Vec;
45 return llvm::make_unique<WrapConsumer>(std::move(Context), std::move(Vec));
49 const std::vector<std::string> &Args)
override {
56 for (StringRef Arg : Args)
57 if (Arg.startswith(
"-checks="))
58 OverrideOptions.
Checks = Arg.substr(strlen(
"-checks="));
60 auto Options = llvm::make_unique<FileOptionsProvider>(
61 GlobalOptions, DefaultOptions, OverrideOptions);
62 Context = llvm::make_unique<ClangTidyContext>(std::move(Options));
67 std::unique_ptr<ClangTidyContext> Context;
76 static clang::FrontendPluginRegistry::Add<clang::tidy::ClangTidyPluginAction>
77 X(
"clang-tidy",
"clang-tidy");
llvm::Optional< std::string > Checks
Checks filter.
bool ParseArgs(const CompilerInstance &, const std::vector< std::string > &Args) override
Contains options for clang-tidy.
volatile int ClangTidyPluginAnchorSource
static ClangTidyModuleRegistry::Add< bugprone::BugproneModule > X("bugprone-module", "Adds checks for bugprone code constructs.")
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef File)
Returns an ASTConsumer that runs the specified clang-tidy checks.
The core clang tidy plugin action.
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &Compiler, StringRef File) override