[clang] [APINotes] Diagnose invalid Where.Parameters selectors (PR #209408)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 24 09:19:17 PDT 2026


================
@@ -1072,6 +1073,69 @@ getAPINotesParameterSelectorCandidates(const Sema &S, const FunctionDecl *FD) {
   return Candidates;
 }
 
+static api_notes::APINotesFunctionSelectorKey
+getBroadAPINotesSelectorKey(api_notes::APINotesFunctionSelectorKey Key) {
+  Key.ParameterTypeIDs = std::nullopt;
----------------
StoeckOverflow wrote:

This was deriving the diagnostic’s name-level key from an exact selector key. A raw name comparison is not enough, because the same name can appear in different API-notes contexts or tables. So the diagnostic key must keep the parent context and API-notes table kind, but drop only the overload selector.

In the latest update I moved this behind `APINotesFunctionSelectorKey::getWithoutParameterSelector()`, which now constructs the name-level key directly instead of copying the exact key and clearing `ParameterTypeIDs` in `SemaAPINotes.cpp`.

https://github.com/llvm/llvm-project/pull/209408


More information about the cfe-commits mailing list