diff --git a/llvm/include/llvm/Object/OffloadBinary.h b/llvm/include/llvm/Object/OffloadBinary.h --- a/llvm/include/llvm/Object/OffloadBinary.h +++ b/llvm/include/llvm/Object/OffloadBinary.h @@ -59,6 +59,9 @@ /// offsets from the beginning of the file. class OffloadBinary : public Binary { public: + using string_iterator = StringMap::const_iterator; + using string_iterator_range = iterator_range; + /// The offloading metadata that will be serialized to a memory buffer. struct OffloadingImage { ImageKind TheImageKind; @@ -88,6 +91,11 @@ return StringRef(&Buffer[TheEntry->ImageOffset], TheEntry->ImageSize); } + // Iterator over all the key and value pairs in the binary. + string_iterator_range strings() const { + return string_iterator_range(StringData.begin(), StringData.end()); + } + StringRef getString(StringRef Key) const { return StringData.lookup(Key); } static bool classof(const Binary *V) { return V->isOffloadFile(); }