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

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


================
@@ -893,6 +911,80 @@ APINotesReader::Implementation::getIdentifier(llvm::StringRef Str) {
   return *Known;
 }
 
+std::optional<llvm::StringRef>
+APINotesReader::Implementation::getIdentifierString(IdentifierID ID) {
+  if (!IdentifierTable)
+    return std::nullopt;
+
+  if (ID == IdentifierID(0))
+    return llvm::StringRef();
+
+  if (!IdentifierStringsInitialized) {
+    IdentifierStringsInitialized = true;
+    // keys() and data() iterate over the same serialized entries in lockstep,
+    // so build the reverse cache without doing a lookup for each key.
+    auto Identifiers = IdentifierTable->keys();
----------------
StoeckOverflow wrote:

I tried both `llvm::zip` and `llvm::zip_equal`, but they do not work with
`OnDiskIterableChainedHashTable` here. The table’s key/data iterators do not provide the standard iterator traits (`iterator_category`, `difference_type`, etc.) that the LLVM zip adaptor expects, so the zipped range fails to compile. I kept the manual lockstep iteration for that reason.

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


More information about the cfe-commits mailing list