[PATCH] D127774: [Binary] Add iterator to the OffloadBinary string maps
Joseph Huber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 14 13:48:26 PDT 2022
jhuber6 updated this revision to Diff 436914.
jhuber6 added a comment.
addressing comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127774/new/
https://reviews.llvm.org/D127774
Files:
llvm/include/llvm/Object/OffloadBinary.h
Index: llvm/include/llvm/Object/OffloadBinary.h
===================================================================
--- llvm/include/llvm/Object/OffloadBinary.h
+++ 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<StringRef>::const_iterator;
+ using string_iterator_range = iterator_range<string_iterator>;
+
/// 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(); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127774.436914.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220614/089652a9/attachment.bin>
More information about the llvm-commits
mailing list