31 std::set<unsigned> Was;
36 for (
unsigned Char :
Regex) {
48 if (Char ==
'.' || Char ==
'*') {
54 if (Escaped && Char >=
'1' && Char <=
'9') {
60 Tri = ((Tri << 8) + Char) & 0xFFFFFF;
71 if (!Was.count(Tri)) {
73 Index[Tri].push_back(Counts.size());
83 Counts.push_back(Cnt);
89 std::vector<unsigned> CurCounts(Counts.size());
91 for (
size_t I = 0;
I < Query.
size();
I++) {
92 Tri = ((Tri << 8) + Query[
I]) & 0xFFFFFF;
95 const auto &II =
Index.find(Tri);
96 if (II ==
Index.end())
98 for (
size_t J : II->second) {
102 if (CurCounts[J] >= Counts[J])
static bool isAdvancedMetachar(unsigned Char)
static const char RegexAdvancedMetachars[]
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
bool isDefinitelyOut(StringRef Query) const
Returns true, if special case list definitely does not have a line that matches the query.
void insert(const std::string &Regex)
Inserts a new Regex into the index.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.