22 #include <unordered_map> 29 return strchr(RegexAdvancedMetachars, Char) !=
nullptr;
34 std::set<unsigned> Was;
39 for (
unsigned Char : Regex) {
51 if (Char ==
'.' || Char ==
'*') {
57 if (Escaped && Char >=
'1' && Char <=
'9') {
63 Tri = ((Tri << 8) + Char) & 0xFFFFFF;
71 if (Index[Tri].
size() >= 4)
74 if (!Was.count(Tri)) {
76 Index[Tri].push_back(Counts.size());
86 Counts.push_back(Cnt);
92 std::vector<unsigned> CurCounts(Counts.size());
94 for (
size_t I = 0;
I < Query.
size();
I++) {
95 Tri = ((Tri << 8) + Query[
I]) & 0xFFFFFF;
98 const auto &II = Index.find(Tri);
99 if (II == Index.end())
101 for (
size_t J : II->second) {
105 if (CurCounts[J] >= Counts[J])
This class represents lattice values for constants.
bool isDefinitelyOut(StringRef Query) const
Returns true, if special case list definitely does not have a line that matches the query...
static const char RegexAdvancedMetachars[]
static bool isAdvancedMetachar(unsigned Char)
void insert(std::string Regex)
Inserts a new Regex into the index.
LLVM_NODISCARD size_t size() const
size - Get the string size.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
StringRef - Represent a constant reference to a string, i.e.