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

John Hui via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 27 00:27:42 PDT 2026


================
@@ -833,6 +840,17 @@ class APINotesReader::Implementation {
   /// optional if the string is unknown.
   std::optional<IdentifierID> getIdentifier(llvm::StringRef Str);
 
+  /// Retrieve the identifier string for the given ID, or an empty optional if
+  /// the ID is unknown.
+  std::optional<llvm::StringRef> getIdentifierString(IdentifierID ID);
+
+  /// Collect exact parameter selector keys stored in the given function-like
+  /// table.
+  template <typename TableT>
+  bool collectExactFunctionParameterSelectors(
+      TableT *Table, bool IsCXXMethod,
----------------
j-hui wrote:

Since this is only ever called with `SerializedGlobalFunctionTable` and `SerializedCXXMethodTable`, I wonder if you can do some metaprogramming in `collectExactFunctionParameterSelectors` to get rid of the `IsCXXMethod` parameter, e.g. something like:

```c++
static_assert(std::is_same<SerializedGlobalFunctionTable, TableT> ||
              std::is_same<SerializedCXXMethodTable, TableT>);
bool IsCXXMethod = std::is_same_v<SerializedCXXMethodTable, TableT>;
```

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


More information about the cfe-commits mailing list