diff options
author | Alexander Kornienko <alexfh@google.com> | 2014-06-05 13:31:45 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2014-06-05 13:31:45 +0000 |
commit | ac560ec8cb8ae943afe2f10a954f70b146cd1cd6 (patch) | |
tree | a8c407786a6d9933e178a1fdfcd9e6080af49ec4 /clang-tidy/ClangTidy.h | |
parent | e04d0b1c607170f31ce312ee2c6181bbda6f1ee1 (diff) |
Allow per-file clang-tidy options.
Summary:
This patch makes it possible for clang-tidy clients to provide
different options for different translation units. The option, which doesn't
make sense to be file-dependent, was moved to a separate ClangTidyGlobalOptions
struct. Added parsing of ClangTidyOptions.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3979
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@210260 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/ClangTidy.h')
-rw-r--r-- | clang-tidy/ClangTidy.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/clang-tidy/ClangTidy.h b/clang-tidy/ClangTidy.h index 51fb2fe9..8b181fc8 100644 --- a/clang-tidy/ClangTidy.h +++ b/clang-tidy/ClangTidy.h @@ -16,6 +16,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceManager.h" #include "clang/Tooling/Refactoring.h" +#include <memory> #include <vector> namespace clang { @@ -95,26 +96,21 @@ class ClangTidyCheckFactories; class ClangTidyASTConsumerFactory { public: - ClangTidyASTConsumerFactory(ClangTidyContext &Context, - const ClangTidyOptions &Options); - ~ClangTidyASTConsumerFactory(); + ClangTidyASTConsumerFactory(ClangTidyContext &Context); /// \brief Returns an ASTConsumer that runs the specified clang-tidy checks. clang::ASTConsumer *CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef File); /// \brief Get the list of enabled checks. - std::vector<std::string> getCheckNames(); + std::vector<std::string> getCheckNames(ChecksFilter &Filter); private: typedef std::vector<std::pair<std::string, bool> > CheckersList; - CheckersList getCheckersControlList(); + CheckersList getCheckersControlList(ChecksFilter &Filter); - SmallVector<ClangTidyCheck *, 8> Checks; ClangTidyContext &Context; - ast_matchers::MatchFinder Finder; std::unique_ptr<ClangTidyCheckFactories> CheckFactories; - ClangTidyOptions Options; }; /// \brief Fills the list of check names that are enabled when the provided @@ -122,10 +118,13 @@ private: std::vector<std::string> getCheckNames(const ClangTidyOptions &Options); /// \brief Run a set of clang-tidy checks on a set of files. -ClangTidyStats runClangTidy(const ClangTidyOptions &Options, - const tooling::CompilationDatabase &Compilations, - ArrayRef<std::string> InputFiles, - std::vector<ClangTidyError> *Errors); +/// +/// Takes ownership of the \c OptionsProvider. +ClangTidyStats +runClangTidy(ClangTidyOptionsProvider *OptionsProvider, + const tooling::CompilationDatabase &Compilations, + ArrayRef<std::string> InputFiles, + std::vector<ClangTidyError> *Errors); // FIXME: This interface will need to be significantly extended to be useful. // FIXME: Implement confidence levels for displaying/fixing errors. |