Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/include/llvm/Support/SpecialCaseList.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ class SpecialCaseList {

std::vector<GlobMatcher::Glob> Globs;

RadixTree<iterator_range<StringRef::const_iterator>,
RadixTree<iterator_range<StringRef::const_reverse_iterator>,
RadixTree<iterator_range<StringRef::const_reverse_iterator>,
RadixTree<iterator_range<StringRef::const_iterator>,
SmallVector<const GlobMatcher::Glob *, 1>>>
PrefixSuffixToGlob;
SuffixPrefixToGlob;

RadixTree<iterator_range<StringRef::const_iterator>,
SmallVector<const GlobMatcher::Glob *, 1>>
Expand Down
11 changes: 6 additions & 5 deletions llvm/lib/Support/SpecialCaseList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,19 @@ void SpecialCaseList::GlobMatcher::preprocess(bool BySize) {
}
}

auto &SToGlob = PrefixSuffixToGlob.emplace(Prefix).first->second;
auto &V = SToGlob.emplace(reverse(Suffix)).first->second;
auto &PToGlob = SuffixPrefixToGlob.emplace(reverse(Suffix)).first->second;
auto &V = PToGlob.emplace(Prefix).first->second;
V.emplace_back(&G);
}
}

void SpecialCaseList::GlobMatcher::match(
StringRef Query,
llvm::function_ref<void(StringRef Rule, unsigned LineNo)> Cb) const {
if (!PrefixSuffixToGlob.empty()) {
for (const auto &[_, SToGlob] : PrefixSuffixToGlob.find_prefixes(Query)) {
for (const auto &[_, V] : SToGlob.find_prefixes(reverse(Query))) {
if (!SuffixPrefixToGlob.empty()) {
for (const auto &[_, PToGlob] :
SuffixPrefixToGlob.find_prefixes(reverse(Query))) {
for (const auto &[_, V] : PToGlob.find_prefixes(Query)) {
for (const auto *G : V) {
if (G->Pattern.match(Query)) {
Cb(G->Name, G->LineNo);
Expand Down
Loading