LLVM 23.0.0git
ELFAttributeParser.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_ELFATTRIBUTEPARSER_H
10#define LLVM_SUPPORT_ELFATTRIBUTEPARSER_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/ADT/StringRef.h"
14#include "llvm/ADT/bit.h"
15#include "llvm/Support/Error.h"
16
17namespace llvm {
18
20public:
21 virtual ~ELFAttributeParser() = default;
22
23 virtual Error parse(ArrayRef<uint8_t> Section, llvm::endianness Endian) {
24 return llvm::Error::success();
25 }
26 virtual std::optional<unsigned>
27 getAttributeValue(StringRef BuildAttrSubsectionName, unsigned Tag) const {
28 return std::nullopt;
29 }
30 virtual std::optional<unsigned> getAttributeValue(unsigned Tag) const {
31 return std::nullopt;
32 }
33 virtual std::optional<StringRef>
34 getAttributeString(StringRef BuildAttrSubsectionName, unsigned Tag) const {
35 return std::nullopt;
36 }
37 virtual std::optional<StringRef> getAttributeString(unsigned Tag) const {
38 return std::nullopt;
39 }
40};
41
42} // namespace llvm
43#endif // LLVM_SUPPORT_ELFATTRIBUTEPARSER_H
This file implements the C++20 <bit> header.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
virtual std::optional< unsigned > getAttributeValue(StringRef BuildAttrSubsectionName, unsigned Tag) const
virtual std::optional< StringRef > getAttributeString(unsigned Tag) const
virtual Error parse(ArrayRef< uint8_t > Section, llvm::endianness Endian)
virtual ~ELFAttributeParser()=default
virtual std::optional< unsigned > getAttributeValue(unsigned Tag) const
virtual std::optional< StringRef > getAttributeString(StringRef BuildAttrSubsectionName, unsigned Tag) const
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
static ErrorSuccess success()
Create a success value.
Definition Error.h:336
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This is an optimization pass for GlobalISel generic memory operations.
endianness
Definition bit.h:71