From cb6885b295ed6e5d1c71c01efd8c7f6a10e86cc9 Mon Sep 17 00:00:00 2001 From: Dineshkumar Bhaskaran Date: Mon, 8 Jun 2020 09:42:02 +0000 Subject: [PATCH] [ELF] Adding accessor method for getting Note Desc as StringRef Summary: One more way to access note desc. Reviewers: arsenm, scott.linder, saiislam Reviewed By: scott.linder Subscribers: wdng, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81185 --- llvm/include/llvm/Object/ELFTypes.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/include/llvm/Object/ELFTypes.h b/llvm/include/llvm/Object/ELFTypes.h index 32ad1e4..d0909f5 100644 --- a/llvm/include/llvm/Object/ELFTypes.h +++ b/llvm/include/llvm/Object/ELFTypes.h @@ -615,6 +615,12 @@ public: Nhdr.n_descsz); } + /// Get the note's descriptor as StringRef + StringRef getDescAsStringRef() const { + auto &Desc = getDesc(); + return StringRef(reinterpret_cast(Desc.data()), Desc.size()); + } + /// Get the note's type. Elf_Word getType() const { return Nhdr.n_type; } }; -- 2.7.4