================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits