|
12 | 12 | #include "clang/Basic/LLVM.h"
|
13 | 13 | #include "llvm/ADT/StringRef.h"
|
14 | 14 | #include "llvm/Support/Regex.h"
|
15 |
| -#include <memory> |
| 15 | +#include <vector> |
16 | 16 |
|
17 | 17 | namespace clang {
|
18 | 18 | namespace tidy {
|
19 | 19 |
|
20 |
| -/// Read-only set of strings represented as a list of positive and |
21 |
| -/// negative globs. Positive globs add all matched strings to the set, negative |
22 |
| -/// globs remove them in the order of appearance in the list. |
| 20 | +/// Read-only set of strings represented as a list of positive and negative |
| 21 | +/// globs. |
| 22 | +/// |
| 23 | +/// Positive globs add all matched strings to the set, negative globs remove |
| 24 | +/// them in the order of appearance in the list. |
23 | 25 | class GlobList {
|
24 | 26 | public:
|
25 |
| - /// \p GlobList is a comma-separated list of globs (only '*' |
26 |
| - /// metacharacter is supported) with optional '-' prefix to denote exclusion. |
| 27 | + /// \p Globs is a comma-separated list of globs (only the '*' metacharacter is |
| 28 | + /// supported) with an optional '-' prefix to denote exclusion. |
| 29 | + /// |
| 30 | + /// An empty \p Globs string is interpreted as one glob that matches an empty |
| 31 | + /// string. |
27 | 32 | GlobList(StringRef Globs);
|
28 | 33 |
|
29 | 34 | /// Returns \c true if the pattern matches \p S. The result is the last
|
30 | 35 | /// matching glob's Positive flag.
|
31 |
| - bool contains(StringRef S) { return contains(S, false); } |
| 36 | + bool contains(StringRef S); |
32 | 37 |
|
33 | 38 | private:
|
34 |
| - bool contains(StringRef S, bool Contains); |
35 | 39 |
|
36 |
| - bool Positive; |
37 |
| - llvm::Regex Regex; |
38 |
| - std::unique_ptr<GlobList> NextGlob; |
| 40 | + struct GlobListItem { |
| 41 | + bool IsPositive; |
| 42 | + mutable llvm::Regex Regex; |
| 43 | + }; |
| 44 | + std::vector<GlobListItem> Items; |
39 | 45 | };
|
40 | 46 |
|
41 | 47 | } // end namespace tidy
|
|
0 commit comments