================
@@ -1017,6 +1017,50 @@ struct APINotesParameterSelectorCandidates {
std::optional<APINotesParameterSelector> Desugared;
};
+struct APINotesParameterSelectorSet {
+ SmallVector<APINotesParameterSelector, 4> Selectors;
+
+ void add(const APINotesParameterSelector &Selector) {
+ Selectors.push_back(Selector);
+ }
+
+ void add(ArrayRef<std::string> Parameters) {
+ APINotesParameterSelector Selector;
+ Selector.Parameters.append(Parameters.begin(), Parameters.end());
+ add(Selector);
+ }
+
+ void add(const APINotesParameterSelectorCandidates &Candidates) {
+ add(Candidates.Source);
+ if (Candidates.Desugared)
+ add(*Candidates.Desugared);
+ }
+
+ bool contains(ArrayRef<std::string> Parameters) const {
+ for (const APINotesParameterSelector &Selector : Selectors) {
+ if (Selector.Parameters.size() != Parameters.size())
----------------
Xazax-hun wrote:
Are we reimplementing an `operator==` here? In case we do not have that for
`SmallVector`, we should definitely have that for `ArrayRef`, so you could
construct two arrays refs and use their `operator==` to simplify in the worst
case.
https://github.com/llvm/llvm-project/pull/209408
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits