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

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 22 02:12:55 PDT 2026


================
@@ -22,6 +26,49 @@ class raw_ostream;
 
 namespace clang {
 namespace api_notes {
+
+std::string
+formatAPINotesParameterSelector(llvm::ArrayRef<llvm::StringRef> Parameters);
+std::string
+formatAPINotesParameterSelector(llvm::ArrayRef<std::string> Parameters);
+
+/// Stable reader-facing identity for an API notes function selector entry.
+///
+/// This mirrors the serialized function table key closely enough for Sema-side
+/// diagnostics to use it as a DenseMap key, without exposing the reader's
+/// private FunctionTableKey implementation type.
+struct APINotesFunctionSelectorKey {
+  bool IsCXXMethod = false;
----------------
StoeckOverflow wrote:

For the `IsCXXMethod` bit, I think it is useful to keep the table kind explicit
here. The call site that creates this key already knows whether it is collecting from the function table or the C++ method table. If we remove the bit, we would throw that information away and later need to infer it from `ParentContextID`.

That inference might be possible in some cases by resolving context metadata, but it would add an extra lookup and mix two separate concepts: the parent declaration context and the APINotes table that stored the selector.

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


More information about the cfe-commits mailing list