[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:09:44 PDT 2020


dineshkb-amd created this revision.
dineshkb-amd added a reviewer: arsenm.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

One more way to access note desc.


Repository:
  rG LLVM Github Monorepo

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.268553.patch
Type: text/x-patch
Size: 563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200604/6d42fb09/attachment-0001.bin>


More information about the llvm-commits mailing list