10 #include "llvm/ADT/SmallString.h"
20 llvm::sys::SmartScopedReader<true> reader(blobMapLock);
22 auto it = blobMap.find(name);
23 return it != blobMap.end() ? &it->second :
nullptr;
29 assert(entry &&
"`update` expects an existing entry for the provided name");
30 entry->
setBlob(std::move(newBlob));
34 std::optional<AsmResourceBlob> blob)
36 llvm::sys::SmartScopedWriter<true> writer(blobMapLock);
39 auto tryInsertion = [&](StringRef name) ->
BlobEntry * {
40 auto it = blobMap.try_emplace(name,
BlobEntry());
42 it.first->second.initialize(it.first->getKey(), std::move(blob));
43 return &it.first->second;
49 if (
BlobEntry *entry = tryInsertion(name))
55 nameStorage.push_back(
'_');
56 size_t nameCounter = 1;
58 Twine(nameCounter++).toVector(nameStorage);
61 if (
BlobEntry *entry = tryInsertion(nameStorage))
63 nameStorage.resize(name.size() + 1);
This class represents a processed binary blob of data.
The class represents an individual entry of a blob.
void setBlob(AsmResourceBlob &&newBlob)
Set the blob owned by this entry.
void update(StringRef name, AsmResourceBlob &&newBlob)
Update the blob for the entry defined by the provided name.
BlobEntry & insert(StringRef name, std::optional< AsmResourceBlob > blob={})
Insert a new entry with the provided name and optional blob data.
BlobEntry * lookup(StringRef name)
Return the blob registered for the given name, or nullptr if no blob is registered.
Include the generated interface declarations.