llvm-project
ee71eb83 - [APINotes] Match function-like Where.Parameters in Sema (#205307)

Commit
18 days ago
[APINotes] Match function-like Where.Parameters in Sema (#205307) This PR teaches Sema to apply function-like `Where.Parameters` selectors for API notes. It builds on #204147 by using the serialized `Where.Parameters` selector keys in Sema. For each `FunctionDecl` / `CXXMethodDecl`, Sema derives an exact parameter selector from the declaration’s `FunctionProtoType`. Broad name-only API notes lookup still runs first, preserving existing behavior. If Clang can form a parameter selector, Sema then performs an exact selector lookup and applies that result second, allowing overload-specific notes to refine same-name broad notes. Tests: - Adds end-to-end module APINotes Sema coverage (`.apinotes` source -> binary APINotes -> reader lookup -> Sema matching -> AST result) - Covers core matching behavior for global functions and C++ methods, including same-name overloads, exact empty selectors, broad-plus-exact coexistence and mismatched selectors - Covers important edge cases: default arguments, static methods, alias spellings remaining non-canonicalized, by-value `const`, namespaced functions, and overloaded operators. This PR does not add duplicate-selector or unmatched-selector diagnostics. Those remain for a follow-up diagnostics PR. **Note**: this PR was originally stacked on top of #204147. It has now been rebased on top of main containing those changes, so the remaining diff should reflect only the top commit specific to this PR. Reviewers: @Xazax-hun @j-hui @egorzhdan --------- Co-authored-by: John Hui <updog@j-hui.com>
Parents
Loading