[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
Sun Jun 7 04:45:20 PDT 2020


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

Updated arsenm's comment.


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
@@ -615,6 +615,12 @@
         Nhdr.n_descsz);
   }
 
+  /// 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 type.
   Elf_Word getType() const { return Nhdr.n_type; }
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81185.269046.patch
Type: text/x-patch
Size: 533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200607/565ead0b/attachment.bin>


More information about the llvm-commits mailing list