@@ -52,15 +52,14 @@ Error SpecialCaseList::Matcher::insert(StringRef Pattern, unsigned LineNumber,
52
52
if (!CheckRE.isValid (REError))
53
53
return createStringError (errc::invalid_argument, REError);
54
54
55
- RegExes.emplace_back (std::make_pair (
56
- std::make_unique<Regex>(std::move (CheckRE)), LineNumber));
55
+ auto Rg =
56
+ std::make_unique<Matcher::Reg>(Pattern, LineNumber, std::move (CheckRE));
57
+ RegExes.emplace_back (std::move (Rg));
57
58
58
59
return Error::success ();
59
60
}
60
61
61
- auto Glob = std::make_unique<Matcher::Glob>();
62
- Glob->Name = Pattern.str ();
63
- Glob->LineNo = LineNumber;
62
+ auto Glob = std::make_unique<Matcher::Glob>(Pattern, LineNumber);
64
63
// We must be sure to use the string in `Glob` rather than the provided
65
64
// reference which could be destroyed before match() is called
66
65
if (auto Err = GlobPattern::create (Glob->Name , /* MaxSubPatterns=*/ 1024 )
@@ -76,9 +75,9 @@ void SpecialCaseList::Matcher::match(
76
75
for (const auto &Glob : reverse (Globs))
77
76
if (Glob->Pattern .match (Query))
78
77
Cb (Glob->Name , Glob->LineNo );
79
- for (const auto &[ Regex, LineNumber] : reverse (RegExes))
80
- if (Regex->match (Query))
81
- Cb (/* FIXME: there is no users of this param yet */ " " , LineNumber );
78
+ for (const auto &Regex : reverse (RegExes))
79
+ if (Regex->Rg . match (Query))
80
+ Cb (Regex-> Name , Regex-> LineNo );
82
81
}
83
82
84
83
// TODO: Refactor this to return Expected<...>
0 commit comments