summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-08-06 11:49:10 +0000
committerAlexander Kornienko <alexfh@google.com>2014-08-06 11:49:10 +0000
commitb3d331d18dbfdfb356b234077bc0bf14a0fdea14 (patch)
tree9cbbf1ec16f66fd95e0d44d8b7407ffe91a3962f /clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
parenta11da0c8cd79cf3945427870c95f0011da990956 (diff)
downloadbcm5719-llvm-b3d331d18dbfdfb356b234077bc0bf14a0fdea14.tar.gz
bcm5719-llvm-b3d331d18dbfdfb356b234077bc0bf14a0fdea14.zip
Rename ChecksFilter to GlobList, as there's nothing specific to checks in it.
Summary: Rename ChecksFilter to GlobList, as there's nothing specific to checks in it. It's a rather generic way to represent sets of strings (or patterns), so it may be used for something else in ClangTidy. The new name would not look strange when used to filter other entities. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4806 llvm-svn: 214961
Diffstat (limited to 'clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h')
-rw-r--r--clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
index d1529a93d69..107a7817a6f 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
@@ -65,24 +65,25 @@ struct ClangTidyError {
Level DiagLevel;
};
-/// \brief Filters checks by name.
-class ChecksFilter {
+/// \brief Read-only set of strings represented as a list of positive and
+/// negative globs. Positive globs add all matched strings to the set, negative
+/// globs remove them in the order of appearance in the list.
+class GlobList {
public:
/// \brief \p GlobList is a comma-separated list of globs (only '*'
/// metacharacter is supported) with optional '-' prefix to denote exclusion.
- ChecksFilter(StringRef GlobList);
+ GlobList(StringRef Globs);
- /// \brief Returns \c true if the check with the specified \p Name should be
- /// enabled. The result is the last matching glob's Positive flag. If \p Name
- /// is not matched by any globs, the check is not enabled.
- bool isCheckEnabled(StringRef Name) { return isCheckEnabled(Name, false); }
+ /// \brief Returns \c true if the pattern matches \p S. The result is the last
+ /// matching glob's Positive flag.
+ bool contains(StringRef S) { return contains(S, false); }
private:
- bool isCheckEnabled(StringRef Name, bool Enabled);
+ bool contains(StringRef S, bool Contains);
bool Positive;
llvm::Regex Regex;
- std::unique_ptr<ChecksFilter> NextFilter;
+ std::unique_ptr<GlobList> NextGlob;
};
/// \brief Contains displayed and ignored diagnostic counters for a ClangTidy
@@ -145,7 +146,7 @@ public:
StringRef getCheckName(unsigned DiagnosticID) const;
/// \brief Returns check filter for the \c CurrentFile.
- ChecksFilter &getChecksFilter();
+ GlobList &getChecksFilter();
/// \brief Returns global options.
const ClangTidyGlobalOptions &getGlobalOptions() const;
@@ -179,7 +180,7 @@ private:
std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider;
std::string CurrentFile;
- std::unique_ptr<ChecksFilter> CheckFilter;
+ std::unique_ptr<GlobList> CheckFilter;
ClangTidyStats Stats;
OpenPOWER on IntegriCloud