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