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

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 20 07:30:29 PDT 2026


================
@@ -893,6 +905,53 @@ 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();
+
+  for (llvm::StringRef Identifier : IdentifierTable->keys()) {
+    auto KnownID = IdentifierTable->find(Identifier);
----------------
Xazax-hun wrote:

Hmm, it is unfortunate that we need a lookup here. I think it would not be too hard to add a `getValue` or similar operation to the key iterator. But alternatively we could do something like `llvm::zip(IdentifierTable->keys(), IdentifierTable->data())` to avoid this lookup and have a pair of iterators. 

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


More information about the cfe-commits mailing list