[PATCH] D81185: [ELF] Adding accessor method for getting Note Desc as StringRef

Dineshkumar Bhaskaran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 12:42:52 PDT 2020


dineshkb-amd updated this revision to Diff 268560.
dineshkb-amd added a comment.

Updated to use reference.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81185/new/

https://reviews.llvm.org/D81185

Files:
  llvm/include/llvm/Object/ELFTypes.h


Index: llvm/include/llvm/Object/ELFTypes.h
===================================================================
--- llvm/include/llvm/Object/ELFTypes.h
+++ llvm/include/llvm/Object/ELFTypes.h
@@ -605,6 +605,12 @@
                      Nhdr.n_namesz - 1);
   }
 
+  /// Get the note's descriptor as StringRef
+  StringRef getDescAsStringRef() const {
+    auto &Desc = getDesc();
+    return StringRef(reinterpret_cast<const char *>(Desc.data()), Desc.size());
+  }
+
   /// Get the note's descriptor.
   ArrayRef<uint8_t> getDesc() const {
     if (!Nhdr.n_descsz)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81185.268560.patch
Type: text/x-patch
Size: 564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200604/b10765c0/attachment-0001.bin>


More information about the llvm-commits mailing list