================
@@ -1072,6 +1110,56 @@ getAPINotesParameterSelectorCandidates(const Sema &S, 
const FunctionDecl *FD) {
   return Candidates;
 }
 
+static void collectOverloadParameterSelectors(const Sema &S, FunctionDecl *FD,
+                                              APINotesParameterSelectorSet 
&Set,
+                                              bool &IsRepresentative) {
+  IsRepresentative = false;
+  bool FoundRepresentative = false;
+
+  auto AddCandidate = [&](const FunctionDecl *Candidate) {
+    if (!FoundRepresentative) {
+      IsRepresentative =
+          Candidate->getCanonicalDecl() == FD->getCanonicalDecl();
+      FoundRepresentative = true;
+    }
+
+    if (auto Candidates = getAPINotesParameterSelectorCandidates(S, Candidate))
+      Set.add(*Candidates);
+  };
+
+  for (Decl *D : FD->getDeclContext()->noload_decls()) {
----------------
Xazax-hun wrote:

I am a bit anxious about enumerating all the declarations here. This can get 
quadratic really easily as we enumerate all declarations each time we process a 
new function declaration. It would be nice if we were able to solve the problem 
without this. 

Would it be possible to keep some state around whenever a selector was matched 
and only detect unmatched selectors as a last step once we finished processing 
a TU and some selectors are unused?

https://github.com/llvm/llvm-project/pull/209408
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to