10 #include "llvm/ADT/SmallString.h" 12 using namespace clang;
18 GlobList = GlobList.trim(
" \r\n");
19 if (GlobList.startswith(
"-")) {
20 GlobList = GlobList.substr(1);
29 StringRef UntrimmedGlob = GlobList.substr(0, GlobList.find(
','));
30 StringRef Glob = UntrimmedGlob.trim(
' ');
31 GlobList = GlobList.substr(UntrimmedGlob.size() + 1);
32 SmallString<128> RegexText(
"^");
33 StringRef MetaChars(
"()^$|*+?.[]\\{}");
36 RegexText.push_back(
'.');
37 else if (MetaChars.find(C) != StringRef::npos)
38 RegexText.push_back(
'\\');
39 RegexText.push_back(C);
41 RegexText.push_back(
'$');
42 return llvm::Regex(RegexText);
50 Items.push_back(std::move(Item));
51 }
while (!Globs.empty());
55 bool Contains =
false;
56 for (
const GlobListItem &Item : Items) {
57 if (Item.Regex.match(S))
58 Contains = Item.IsPositive;
Read-only set of strings represented as a list of positive and negative globs.
static llvm::Regex ConsumeGlob(StringRef &GlobList)
GlobList(StringRef Globs)
Globs is a comma-separated list of globs (only the '*' metacharacter is supported) with an optional '...
static bool ConsumeNegativeIndicator(StringRef &GlobList)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
bool contains(StringRef S)
Returns true if the pattern matches S.