LLVM 22.0.0git
ELFAttrParserExtended.h
Go to the documentation of this file.
1//===- ELF AttributeParser.h - ELF Attribute Parser -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_SUPPORT_ELFEXTENDEDATTRPARSER_H
10#define LLVM_SUPPORT_ELFEXTENDEDATTRPARSER_H
11
12#include "llvm/ADT/ArrayRef.h"
17#include "llvm/Support/Error.h"
18#include <optional>
19#include <vector>
20
21namespace llvm {
22class StringRef;
23class ScopedPrinter;
24
26protected:
30
31 // Data structure for holding Extended ELF Build Attribute subsection
33 // Maps SubsectionName + Tag to tags names. Required for printing comments.
34 const std::vector<SubsectionAndTagToTagName> TagsNamesMap;
35 StringRef getTagName(const StringRef &BuildAttrSubsectionName,
36 const unsigned Tag);
37
38public:
39 virtual ~ELFExtendedAttrParser() { static_cast<void>(!Cursor.takeError()); }
41
42 std::optional<unsigned> getAttributeValue(unsigned Tag) const override;
43 std::optional<unsigned> getAttributeValue(StringRef BuildAttrSubsectionName,
44 unsigned Tag) const override;
45 std::optional<StringRef> getAttributeString(unsigned Tag) const override;
46 std::optional<StringRef> getAttributeString(StringRef BuildAttrSubsectionName,
47 unsigned Tag) const override;
48
50 ScopedPrinter *Sw,
51 const std::vector<SubsectionAndTagToTagName> TagsNamesMap)
52 : Sw(Sw), TagsNamesMap(TagsNamesMap) {}
54 const std::vector<SubsectionAndTagToTagName> TagsNamesMap)
55 : Sw(nullptr), TagsNamesMap(TagsNamesMap) {}
56};
57} // namespace llvm
58#endif // LLVM_SUPPORT_ELFEXTENDEDATTRPARSER_H
#define LLVM_ABI
Definition: Compiler.h:213
endianness Endian
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
A class representing a position in a DataExtractor, as well as any error encountered during extractio...
Definition: DataExtractor.h:55
const std::vector< SubsectionAndTagToTagName > TagsNamesMap
ELFExtendedAttrParser(ScopedPrinter *Sw, const std::vector< SubsectionAndTagToTagName > TagsNamesMap)
ELFExtendedAttrParser(const std::vector< SubsectionAndTagToTagName > TagsNamesMap)
SmallVector< BuildAttributeSubSection, 8 > SubSectionVec
Lightweight error class with error context and mandatory checking.
Definition: Error.h:159
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
endianness
Definition: bit.h:71
Definition: regcomp.c:186